/usr/include/gofigure2/QGoTraceSettingsWidget.h is in libgofigure-dev 0.9.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | /*=========================================================================
Authors: The GoFigure Dev. Team.
at Megason Lab, Systems biology, Harvard Medical school, 2009-11
Copyright (c) 2009-11, President and Fellows of Harvard College.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the President and Fellows of Harvard College
nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef __QGoTraceSettingsWidget_h
#define __QGoTraceSettingsWidget_h
#include <QWidget>
#include <QComboBox>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "QGoSelectedColorComboBox.h"
#include "QGoCollectionColorComboBox.h"
#include "QGoComboBox.h"
#include <QToolBar>
#include "QGoGUILibConfigure.h"
/**
\class QGoTraceSettingsWidget
\brief this class contains all the comboboxes for collectionID,color,
celltypes and subcelltypes, and displays the trace and collection name.
\ingroup GUI
*/
class QGOGUILIB_EXPORT QGoTraceSettingsWidget:
public QWidget
{
Q_OBJECT
public:
explicit QGoTraceSettingsWidget(QWidget *parent = 0);
~QGoTraceSettingsWidget();
typedef QGoColorComboBox::ItemColorComboboxData ItemColorComboboxData;
typedef std::vector< std::pair< std::string, std::string > >
NamesDescrContainerType;
QComboBox * m_SelectedTrace;
QGoSelectedColorComboBox* m_SelectedColorComboBox;
QGoCollectionColorComboBox* m_CollectionColorComboBox;
QGoComboBox * m_ChoseCellType;
QGoComboBox * m_ChoseSubCellType;
/**
\brief get the name of the trace currently displayed in the QLabel
\return std::string contains the name of the trace
*/
std::string GetTraceName();
/**
\brief set the selected celltype in the combobox corresponding to iCellTypeText
\param[in] iCellTypeText name of the CellType to be selected
*/
void SetCurrentCellType(std::string iCellTypeText);
/**
\brief set the selected subcelltype in the combobox corresponding to the previous
selected one, stored in m_SelectedSubCellType
*/
void SetCurrentCellTypeToSelectedOne();
/**
\brief set the selected subcelltype in the combobox corresponding to iSubCellTypeText
\param[in] iSubCellTypeText name of the SubCellType to be selected
*/
void SetCurrentSubCellType(std::string iSubCellTypeText);
/**
\brief set the selected subcelltype in the combobox corresponding to the previous
selected one, stored in m_SelectedSubCellType
*/
void SetCurrentSubCellTypeToSelectedOne();
/**
\brief set the selected color in the combobox corresponding to iColorText
\param[in] iColorText name of the Color to be selected
*/
void SetCurrentColor(std::string iColorText);
/**
\brief set the selected color in the combobox corresponding to the previous
selected one, stored in m_SelectedColorData
*/
void SetCurrentColorToSelectedOne();
/**
\brief set the selected collectionID in the combobox to iID
\param[in] iID ID of the collection to be selected
*/
void SetCurrentCollectionID(std::string iID);
void SetCurrentTraceName(std::string iTraceName);
/**
\brief update the QLabel with iTrace and iCollection, the "add a new.." in the
CollectionColorComboBox and hide/show the celltype and subcelltype comboboxes
according to the iTrace
\param[in] iTrace name of the trace to update
\param[in] iCollection name of the collection to update
*/
//void UpdateTraceAndCollection(
// std::string iTrace, std::string iCollection);
/**
\brief replace the list of collectionID with the ID and corresponding color
in the iListExistingID and select the ID corresponding to iCollectionIDtoSelect
if not empty, if empty, select the 1rst one
\param[in] iListExistingID list of IDs with QColor to be displayed
\param[in] iCollectionIDtoSelect ID to be selected in the combobox
*/
void SetListCollectionID(
std::list< ItemColorComboboxData > iListExistingID,
std::string iCollectionIDtoSelect = "");
/**
\brief replace the list of colors with the name and corresponding color
in the iListColors and select the color corresponding to iColortoSelect
if not empty, if empty, select the 1rst one
\param[in] iListColors list of colors with their names and QColor to be displayed
\param[in] iColorToSelect name of the color to be selected in the combobox
*/
void SetListColors(std::list< ItemColorComboboxData > iListColors,
std::string iColorToSelect = "");
/**
\brief replace the list of colors with the name and corresponding color
in the iListColors and select the color corresponding to m_SelectedColorData
\param[in] iListColors list of colors with their names and QColor to be displayed
*/
void SetListColorsWithSelectedOne(std::list< ItemColorComboboxData > iListColors);
/**
\brief replace the list of celltype with the names in the iCellTypesData and
select the celltype corresponding to iCellTypetoSelect if not empty, if empty,
select the 1rst one.
\param[in] iCellTypesData list of celltypes with their names and description
to be displayed
\param[in] iCellTypeToSelect name of the celltype to be selected in the combobox
*/
void SetListCellTypes(NamesDescrContainerType iCellTypesData,
std::string iCellTypeToSelect = "");
/**
\brief replace the list of celltype with the name in the iCellTypesData
and select the celltype corresponding to m_SelectedCelltype
\param[in] iCellTypesData list of celltypes with their names and description
to be displayed
*/
void SetListCellTypeWithSelectedOne(NamesDescrContainerType iCellTypesData);
/**
\brief replace the list of subcelltype with the names in the iSubCellTypesData and
select the subcelltype corresponding to iSubCellTypetoSelect if not empty, if empty,
select the 1rst one.
\param[in] iSubCellData list of subcelltypes with their names and description
to be displayed
\param[in] iSubCellTypeToSelect name of the subcelltype to be selected in the combobox
*/
void SetListSubCellTypes(NamesDescrContainerType iSubCellData,
std::string iSubCellTypeToSelect = "");
/**
\brief replace the list of subcelltype with the name in the iSubCellTypesData
and select the subcelltype corresponding to m_SelectedSubCelltype
\param[in] iSubCellTypesData list of subcelltypes with their names and description
to be displayed
*/
void SetListSubCellTypeWithSelectedOne(NamesDescrContainerType iSubCellTypesData);
std::string* GetPointerSelectedCellType();
std::string* GetPointerSelectedSubCellType();
ItemColorComboboxData* GetPointerCollectionData();
ItemColorComboboxData* GetPointerColorData();
void SetPointerSelectedCellType(std::string* iCellType);
void SetPointerSelectedSubCellType(std::string* iSubCellType);
void SetPointerCollectionData(ItemColorComboboxData* iCollectionData);
void SetPointerColorData(ItemColorComboboxData* iColorData);
unsigned int GetCurrentSelectedCollectionID();
//bool GetIsToolBarVisible();
public slots:
/**
\brief add a new collection in the collectionColorCombobox and select it
\param[in] iNewCollectionID ID and QColor of the new item
*/
void AddANewCollectionID(std::pair<std::string, QColor> iNewCollectionID);
/**
\brief in order the pointers already deleted are not deleted again
*/
void SetSelectedPointersToNull();
//void SetVisibilityStatus(bool IsVisible);
signals:
void AddANewCellType();
void DeleteCellType();
void AddANewSubCellType();
void DeleteSubCellType();
void AddNewColor();
void DeleteColor();
void NewCollectionToBeCreated();
void TraceChanged( int );
protected:
QLabel * m_CollectionName;
QLabel* m_LabelCellType;
QLabel* m_LabelSubCellType;
std::string * m_SelectedCellType;
std::string * m_SelectedSubCellType;
ItemColorComboboxData * m_SelectedCollectionData;
ItemColorComboboxData * m_SelectedColorData;
//bool m_IsToolBarVisible;
void SetUpUi();
/**
\brief add the SelectedColorCombobox to the layout and make the signal/slot connections
for it
*/
void SetSelectedColorComboBox(QHBoxLayout* iColorLayout);
/**
\brief add the CollectionColorCombobox to the layout,set the trace and collection name labels,
and make the signal/slot connections
for it
*/
void SetTraceCollectionColorComboBox(
QHBoxLayout* iLayoutTraceCollection, QLabel* iLabel);
/**
\brief add the Celltype QGoCombobox to the layout and make the signal/slot connections
for it
*/
void SetCellTypeComboBox(
QHBoxLayout* iCellLayout);
/**
\brief add the SubCellType QGoCombobox to the layout and make the signal/slot connections
for it
*/
void SetSubCellTypeComboBox(
QHBoxLayout* iSubCellLayout);
void SetWidgetFont();
void UpdateCollection(std::string iCollection);
/**
\brief call the right methods to initialize the list if there is no iTextItemToSelect
or select the iTextItemToSelect if not empty.
\param[in] iComboBox the combobox with the list to be set up
\param[in] iItemsData the list of items with their names and descriptions to be displayed
\param[in] iTextItemToSelect the item to be selected
\tparam T could be a QGoComboBox
*/
template< typename T >
void SetListItemAndSelect(T *iComboBox, NamesDescrContainerType iItemsData,
std::string iTextItemToSelect = "")
{
if ( !iTextItemToSelect.empty() )
{
iComboBox->SetItemsFromList(iItemsData);
if ( iComboBox->findText( iTextItemToSelect.c_str() ) != -1 )
{
iComboBox->SetCurrentItem(iTextItemToSelect);
}
else
{
iComboBox->SetCurrentItemAndActivate(0);
}
}
else
{
iComboBox->InitializeTheList(iItemsData);
}
}
/**
\overload
*/
template< typename T >
void SetListItemAndSelect(T *iComboBox, std::list< ItemColorComboboxData > iItemsData,
std::string iTextItemToSelect = "")
{
if ( !iTextItemToSelect.empty() )
{
iComboBox->SetItemsFromListWithColor(iItemsData);
if ( iComboBox->findText( iTextItemToSelect.c_str() ) != -1 )
{
iComboBox->SetCurrentItem(iTextItemToSelect);
}
else
{
iComboBox->SetCurrentItemAndActivate(0);
}
}
else
{
iComboBox->InitializeTheListWithColor(iItemsData);
}
}
protected slots:
void UpdateValueSelectedCollection(ItemColorComboboxData iCollectionData);
void UpdateValueSelectedCellType(std::string iCellType);
void UpdateValueSelectedSubCellType(std::string iSubCellType);
void UpdateValueSelectedColor(ItemColorComboboxData iColorData);
/**
brief update the correspodning collection when the current trace has been changed
and emit a signal that the trace has been changed
*/
void CurrentTraceToUpdate(int iIndex);
};
#endif
|