comparison widgets/WindowTypeSelector.cpp @ 946:36cddc3de023 alignment_view

Merge from default branch
author Chris Cannam
date Mon, 20 Apr 2015 09:19:52 +0100
parents 4a578a360011
children 6645b6b8356f
comparison
equal deleted inserted replaced
897:499b637f2a26 946:36cddc3de023
20 #include <QVBoxLayout> 20 #include <QVBoxLayout>
21 #include <QComboBox> 21 #include <QComboBox>
22 22
23 #include "base/Preferences.h" 23 #include "base/Preferences.h"
24 24
25 WindowTypeSelector::WindowTypeSelector(WindowType defaultType, QWidget *parent) : 25 WindowTypeSelector::WindowTypeSelector(WindowType defaultType)
26 QFrame(parent), 26 {
27 m_windowType(WindowType(999)) 27 init(defaultType);
28 }
29
30 WindowTypeSelector::WindowTypeSelector()
31 {
32 Preferences *prefs = Preferences::getInstance();
33 int min = 0, max = 0, deflt = 0;
34 WindowType type =
35 WindowType(prefs->getPropertyRangeAndValue("Window Type", &min, &max,
36 &deflt));
37 init(type);
38 }
39
40 void
41 WindowTypeSelector::init(WindowType defaultType)
28 { 42 {
29 QVBoxLayout *layout = new QVBoxLayout; 43 QVBoxLayout *layout = new QVBoxLayout;
30 layout->setMargin(0); 44 layout->setMargin(0);
31 setLayout(layout); 45 setLayout(layout);
32 46
46 Preferences *prefs = Preferences::getInstance(); 60 Preferences *prefs = Preferences::getInstance();
47 61
48 m_windowShape = new WindowShapePreview; 62 m_windowShape = new WindowShapePreview;
49 63
50 m_windowCombo = new QComboBox; 64 m_windowCombo = new QComboBox;
51 int min = 0, max = 0, deflt = 0, i = 0;
52 int window = int(defaultType); 65 int window = int(defaultType);
53 if (window == 999) {
54 window = prefs->getPropertyRangeAndValue("Window Type", &min, &max,
55 &deflt);
56 }
57 int index = 0; 66 int index = 0;
58 67
59 for (i = 0; i <= 8; ++i) { 68 for (int i = 0; i <= 8; ++i) {
60 m_windowCombo->addItem(prefs->getPropertyValueLabel("Window Type", 69 m_windowCombo->addItem(prefs->getPropertyValueLabel("Window Type",
61 m_windows[i])); 70 m_windows[i]));
62 if (m_windows[i] == window) index = i; 71 if (m_windows[i] == window) index = i;
63 } 72 }
64 73