TaskPanelView.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 "TaskPanelView.h"
00029 #include "BitmapFactory.h"
00030 #include "iisTaskPanel/include/iisTaskPanel"
00031 #include <Base/Console.h>
00032 
00033 using namespace Gui;
00034 using namespace Gui::DockWnd;
00035 
00036 
00037 /* TRANSLATOR Gui::DockWnd::TaskPanelView */
00038 
00039 TaskPanelView::TaskPanelView(Gui::Document* pcDocument, QWidget *parent)
00040   : DockWindow(pcDocument,parent)
00041 {
00042 #if QT_VERSION <= 0x040104
00043     // tmp. disable the file logging to suppress some bothering warnings related
00044     // to Qt 4.1 because it will really pollute the log file with useless stuff
00045     Base::Console().SetEnabledMsgType("File", ConsoleMsgType::MsgType_Wrn, false);
00046     Base::Console().SetEnabledMsgType("File", ConsoleMsgType::MsgType_Log, false);
00047 #endif
00048 
00049     setWindowTitle(tr( "Task View"));
00050 
00051     QGridLayout* gridLayout = new QGridLayout(this);
00052     iisTaskPanel *taskPanel = new iisTaskPanel(this);
00053     iisTaskBox *tb1 = new iisTaskBox(
00054         Gui::BitmapFactory().pixmap("document-new"),QLatin1String("Group of Tasks"),true, this);
00055     taskPanel->addWidget(tb1);
00056     gridLayout->addWidget(taskPanel, 0, 0, 2, 1);
00057 
00058     iisIconLabel *i1 = new iisIconLabel(
00059         Gui::BitmapFactory().pixmap("view-zoom-in"), QLatin1String("Do Task 1"), tb1);
00060     tb1->addIconLabel(i1);
00061     //connect(i1, SIGNAL(activated()), this, SLOT(task1()));
00062 
00063     iisIconLabel *i2 = new iisIconLabel(
00064         Gui::BitmapFactory().pixmap("view-zoom-out"), QLatin1String("Do Task 2"), tb1);
00065     tb1->addIconLabel(i2);
00066 
00067     QHBoxLayout *hbl = new QHBoxLayout();
00068     tb1->groupLayout()->addLayout(hbl);
00069 
00070     iisIconLabel *i3 = new iisIconLabel(
00071         Gui::BitmapFactory().pixmap("edit-copy"), QLatin1String("Do Task 3"), tb1);
00072     tb1->addIconLabel(i3, false);
00073     hbl->addWidget(i3);
00074 
00075     iisIconLabel *i4 = new iisIconLabel(
00076         Gui::BitmapFactory().pixmap("edit-cut"), QLatin1String("Do Task 4"), tb1);
00077     tb1->addIconLabel(i4, false);
00078     hbl->addWidget(i4);
00079     i4->setColors(Qt::red, Qt::green, Qt::gray);
00080     i4->setFocusPen(QPen());
00081 
00082     iisIconLabel *i5 = new iisIconLabel(
00083         Gui::BitmapFactory().pixmap("edit-paste"), QLatin1String("Do Task 5"), tb1);
00084     tb1->addIconLabel(i5);
00085 
00086     iisTaskBox *tb2 = new iisTaskBox(
00087         Gui::BitmapFactory().pixmap("document-print"), QLatin1String("Non-expandable Group"), false, this);
00088     taskPanel->addWidget(tb2);
00089 
00090     iisIconLabel *i21 = new iisIconLabel(
00091         Gui::BitmapFactory().pixmap("document-new"), QLatin1String("Do Task 2.1"), tb2);
00092     tb2->addIconLabel(i21);
00093 
00094     iisIconLabel *i22 = new iisIconLabel(
00095         Gui::BitmapFactory().pixmap("document-open"), QLatin1String("Do Task 2.2"), tb2);
00096     tb2->addIconLabel(i22);
00097     i22->setEnabled(false);
00098 
00099     iisIconLabel *i23 = new iisIconLabel(
00100         Gui::BitmapFactory().pixmap("document-save"), QLatin1String("Do Task 2.3"), tb2);
00101     tb2->addIconLabel(i23);
00102 
00103     iisTaskBox *tb3 = new iisTaskBox(QPixmap(), QLatin1String("Group without Icons"), true, this);
00104     taskPanel->addWidget(tb3);
00105 
00106     iisIconLabel *i31 = new iisIconLabel(QPixmap(), QLatin1String("Do Task 3.1"), tb3);
00107     tb3->addIconLabel(i31);
00108 
00109     iisIconLabel *i32 = new iisIconLabel(QPixmap(), QLatin1String("Do Task 3.2"), tb3);
00110     tb3->addIconLabel(i32);
00111 
00112     tb3->groupLayout()->addWidget(new QLabel(QLatin1String("Widgets also allowed:"), this));
00113     tb3->groupLayout()->addWidget(new QPushButton(QLatin1String("A Button"), this));
00114 
00115     // Other widgets can be also added to the panel
00116     QLabel *l1 = new QLabel(QLatin1String("A group without header"), this);
00117     taskPanel->addWidget(l1);
00118 
00119 
00120     iisTaskGroup *tb4 = new iisTaskGroup(this);
00121     taskPanel->addWidget(tb4);
00122 
00123     iisIconLabel *i41 = new iisIconLabel(
00124         Gui::BitmapFactory().pixmap("system-log-out"), QLatin1String("Do Task 4.1"), tb4);
00125     tb4->addIconLabel(i41);
00126 
00127     iisIconLabel *i42 = new iisIconLabel(QPixmap(), QLatin1String("Do Task 4.2"), tb4);
00128     tb4->addIconLabel(i42);
00129 
00130     taskPanel->addStretch();
00131     taskPanel->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
00132     //tb1->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
00133     tb2->setScheme(iisWinXPTaskPanelScheme2::defaultScheme());
00134     tb3->setScheme(iisWinXPTaskPanelScheme2::defaultScheme());
00135     //tb4->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
00136 
00137     onUpdate();
00138 
00139     Gui::Selection().Attach(this);
00140 
00141 #if QT_VERSION <= 0x040104
00142     Base::Console().SetEnabledMsgType("File", ConsoleMsgType::MsgType_Wrn, true);
00143     Base::Console().SetEnabledMsgType("File", ConsoleMsgType::MsgType_Log, true);
00144 #endif
00145 }
00146 
00147 TaskPanelView::~TaskPanelView()
00148 {
00149     Gui::Selection().Detach(this);
00150 }
00151 
00153 void TaskPanelView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
00154                             Gui::SelectionSingleton::MessageType Reason)
00155 {
00156     std::string temp;
00157 
00158     if (Reason.Type == SelectionChanges::AddSelection) {
00159     }
00160     else if (Reason.Type == SelectionChanges::ClrSelection) {
00161     }
00162     else if (Reason.Type == SelectionChanges::RmvSelection) {
00163     }
00164     else if (Reason.Type == SelectionChanges::RmvSelection) {
00165     }
00166 }
00167 
00168 void TaskPanelView::onUpdate(void)
00169 {
00170 }
00171 
00172 bool TaskPanelView::onMsg(const char* pMsg)
00173 {
00174     // no messages yet
00175     return false;
00176 }
00178 
00179 #include "moc_TaskPanelView.cpp"

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