Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
ColorScaleConfigDialog.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef COLORSCALECONFIGDIALOG_H_
23 #define COLORSCALECONFIGDIALOG_H_
24 
25 #include <tulip/ColorScale.h>
26 
27 #include <QtGui/QDialog>
28 #include <QtCore/QString>
29 
30 namespace Ui {
31 class ColorScaleDialog;
32 }
33 
34 class QTableWidgetItem;
35 class QListWidgetItem;
36 class QLabel;
37 
38 namespace tlp {
39 
40 class TLP_QT_SCOPE ColorScaleConfigDialog : public QDialog {
41 
42  Q_OBJECT
43 
44 public :
45  ColorScaleConfigDialog(const ColorScale &colorScale = ColorScale(), QWidget *parent = NULL);
46  void setColorScale(const ColorScale &colorScale);
47  ColorScale getColorScale() const;
48 
49 protected :
50 
51  void resizeEvent(QResizeEvent * event);
52  void showEvent(QShowEvent * event);
53 
54 private slots :
55 
56  void accept();
57  void pressButtonBrowse();
58  void nbColorsValueChanged(int value);
59  void colorTableItemDoubleClicked(QTableWidgetItem *item);
60  void displaySavedGradientPreview();
61  void displayUserGradientPreview();
62  void saveCurrentColorScale();
63  void deleteSavedColorScale();
64  void reeditSaveColorScale(QListWidgetItem *savedColorScaleItem);
65  void importColorScaleFromImageFile();
66  void invertEditedColorScale();
67 
68 private :
69  Ui::ColorScaleDialog *_ui;
70 
71  void setColorScaleFromImage(const QString &imageFilePath);
72 
73  void loadUserSavedColorScales();
74  void displayGradientPreview(const QList<QColor> &colorsVector, bool gradient, QLabel *displayLabel);
75 
76  ColorScale colorScale;
77  std::string gradientsImageDirectory;
78 
79  static std::map<QString, std::vector<Color> > tulipImageColorScales;
80  static void loadTulipImageColorScales();
81  static std::vector<Color> getColorScaleFromImage(const QString &imageFilePath);
82 };
83 
84 }
85 
86 #endif /* COLORSCALECONFIGDIALOG_H_ */
87 ///@endcond