kstars
indigroup.cpp
Go to the documentation of this file.00001 /* INDI Group 00002 Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com) 00003 00004 This application is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 JM Changelog 00010 2004-16-1: Start 00011 00012 */ 00013 00014 #include "indiproperty.h" 00015 #include "indigroup.h" 00016 #include "indidevice.h" 00017 #include "devicemanager.h" 00018 00019 #include <klocale.h> 00020 00021 #include <qlayout.h> 00022 #include <qframe.h> 00023 #include <qtimer.h> 00024 #include <qtabwidget.h> 00025 00026 /******************************************************************* 00027 ** INDI Group: a tab widget for common properties. All properties 00028 ** belong to a group, whether they have one or not but how the group 00029 ** is displayed differs 00030 *******************************************************************/ 00031 INDI_G::INDI_G(INDI_D *parentDevice, QString inName) 00032 { 00033 dp = parentDevice; 00034 00035 name = inName; 00036 00037 pl.setAutoDelete(true); 00038 00039 // FIXME what's the parent exactly? 00040 // You can do this eaither way: 00041 // 1. Propertycontainer is a QFrame, then you make QVBoxLayout for it (check form1.cpp) 00042 // 2. Keep it as QVBox and let it handle its children. 00043 // Depends on which one works best. 00044 propertyContainer = new QFrame(dp->groupContainer); 00045 propertyLayout = new QVBoxLayout(propertyContainer, 20, KDialog::spacingHint() ); 00046 VerticalSpacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 00047 00048 propertyLayout->addItem(VerticalSpacer); 00049 00050 dp->groupContainer->addTab(propertyContainer, name); 00051 } 00052 00053 INDI_G::~INDI_G() 00054 { 00055 pl.clear(); 00056 00057 delete(propertyContainer); 00058 } 00059 00060 void INDI_G::addProperty(INDI_P *pp) 00061 { 00062 dp->registerProperty(pp); 00063 00064 propertyLayout->addLayout(pp->PHBox); 00065 propertyLayout->addItem(VerticalSpacer); 00066 00067 pl.append(pp); 00068 } 00069 00070 bool INDI_G::removeProperty(INDI_P *pp) 00071 { 00072 00073 return (pl.remove(pp)); 00074 00075 }