73 m_missionMapModel = DataManager::instance().missionMapModel(); |
73 m_missionMapModel = DataManager::instance().missionMapModel(); |
74 m_themeModel = DataManager::instance().themeModel(); |
74 m_themeModel = DataManager::instance().themeModel(); |
75 |
75 |
76 /* Layouts */ |
76 /* Layouts */ |
77 |
77 |
78 QHBoxLayout * typeLayout = new QHBoxLayout(); |
78 QWidget * topWidget = new QWidget(); |
79 QHBoxLayout * seedLayout = new QHBoxLayout(); |
79 QHBoxLayout * topLayout = new QHBoxLayout(topWidget); |
|
80 topWidget->setContentsMargins(0, 0, 0, 0); |
|
81 topLayout->setContentsMargins(0, 0, 0, 0); |
|
82 |
80 QHBoxLayout * twoColumnLayout = new QHBoxLayout(); |
83 QHBoxLayout * twoColumnLayout = new QHBoxLayout(); |
81 QVBoxLayout * leftLayout = new QVBoxLayout(); |
84 QVBoxLayout * leftLayout = new QVBoxLayout(); |
82 QVBoxLayout * rightLayout = new QVBoxLayout(); |
85 QVBoxLayout * rightLayout = new QVBoxLayout(); |
83 twoColumnLayout->addLayout(leftLayout, 0); |
86 twoColumnLayout->addLayout(leftLayout, 0); |
84 twoColumnLayout->addStretch(1); |
87 twoColumnLayout->addStretch(1); |
85 twoColumnLayout->addLayout(rightLayout, 0); |
88 twoColumnLayout->addLayout(rightLayout, 0); |
86 QVBoxLayout * drawnControls = new QVBoxLayout(); |
89 QVBoxLayout * drawnControls = new QVBoxLayout(); |
87 leftLayout->addLayout(typeLayout, 0); |
|
88 rightLayout->addLayout(seedLayout, 0); |
|
89 |
90 |
90 /* Map type combobox */ |
91 /* Map type combobox */ |
91 |
92 |
92 typeLayout->setSpacing(10); |
93 topLayout->setSpacing(10); |
93 typeLayout->addWidget(new QLabel(tr("Map type:")), 0); |
94 topLayout->addWidget(new QLabel(tr("Map type:")), 0); |
94 cType = new QComboBox(this); |
95 cType = new QComboBox(this); |
95 typeLayout->addWidget(cType, 1); |
96 topLayout->addWidget(cType, 1); |
96 cType->insertItem(0, tr("Image map"), MapModel::StaticMap); |
97 cType->insertItem(0, tr("Image map"), MapModel::StaticMap); |
97 cType->insertItem(1, tr("Mission map"), MapModel::MissionMap); |
98 cType->insertItem(1, tr("Mission map"), MapModel::MissionMap); |
98 cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap); |
99 cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap); |
99 cType->insertItem(3, tr("Randomly generated"), MapModel::GeneratedMap); |
100 cType->insertItem(3, tr("Randomly generated"), MapModel::GeneratedMap); |
100 cType->insertItem(4, tr("Random maze"), MapModel::GeneratedMaze); |
101 cType->insertItem(4, tr("Random maze"), MapModel::GeneratedMaze); |
101 connect(cType, SIGNAL(currentIndexChanged(int)), this, SLOT(mapTypeChanged(int))); |
102 connect(cType, SIGNAL(currentIndexChanged(int)), this, SLOT(mapTypeChanged(int))); |
102 m_childWidgets << cType; |
103 m_childWidgets << cType; |
103 |
104 |
104 /* Randomize button */ |
105 /* Randomize button */ |
105 |
106 |
106 seedLayout->addStretch(1); |
107 topLayout->addStretch(1); |
107 const QIcon& lp = QIcon(":/res/dice.png"); |
108 const QIcon& lp = QIcon(":/res/dice.png"); |
108 QSize sz = lp.actualSize(QSize(65535, 65535)); |
109 QSize sz = lp.actualSize(QSize(65535, 65535)); |
109 btnRandomize = new QPushButton(); |
110 btnRandomize = new QPushButton(); |
110 btnRandomize->setText(tr("Random")); |
111 btnRandomize->setText(tr("Random")); |
111 btnRandomize->setIcon(lp); |
112 btnRandomize->setIcon(lp); |
115 btnRandomize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
116 btnRandomize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
116 connect(btnRandomize, SIGNAL(clicked()), this, SLOT(setRandomMap())); |
117 connect(btnRandomize, SIGNAL(clicked()), this, SLOT(setRandomMap())); |
117 m_childWidgets << btnRandomize; |
118 m_childWidgets << btnRandomize; |
118 btnRandomize->setStyleSheet("padding: 5px;"); |
119 btnRandomize->setStyleSheet("padding: 5px;"); |
119 btnRandomize->setFixedHeight(cType->height()); |
120 btnRandomize->setFixedHeight(cType->height()); |
120 seedLayout->addWidget(btnRandomize, 1); |
121 topLayout->addWidget(btnRandomize, 1); |
121 |
122 |
122 /* Seed button */ |
123 /* Seed button */ |
|
124 |
123 btnSeed = new QPushButton(parentWidget()->parentWidget()); |
125 btnSeed = new QPushButton(parentWidget()->parentWidget()); |
124 btnSeed->setText(tr("Seed")); |
126 btnSeed->setText(tr("Seed")); |
125 btnSeed->setStyleSheet("padding: 5px;"); |
127 btnSeed->setStyleSheet("padding: 5px;"); |
126 btnSeed->setFixedHeight(cType->height()); |
128 btnSeed->setFixedHeight(cType->height()); |
127 connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt())); |
129 connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt())); |
128 seedLayout->addWidget(btnSeed, 0); |
130 topLayout->addWidget(btnSeed, 0); |
129 |
131 |
130 /* Map preview label */ |
132 /* Map preview label */ |
131 |
133 |
132 QLabel * lblMapPreviewText = new QLabel(this); |
134 QLabel * lblMapPreviewText = new QLabel(this); |
133 lblMapPreviewText->setText(tr("Map preview:")); |
135 lblMapPreviewText->setText(tr("Map preview:")); |
135 |
137 |
136 /* Map Preview */ |
138 /* Map Preview */ |
137 |
139 |
138 mapPreview = new QPushButton(this); |
140 mapPreview = new QPushButton(this); |
139 mapPreview->setObjectName("mapPreview"); |
141 mapPreview->setObjectName("mapPreview"); |
|
142 mapPreview->setFlat(true); |
140 mapPreview->setFixedSize(256, 128); |
143 mapPreview->setFixedSize(256, 128); |
141 mapPreview->setContentsMargins(0, 0, 0, 0); |
144 mapPreview->setContentsMargins(0, 0, 0, 0); |
142 leftLayout->addWidget(mapPreview, 0); |
145 leftLayout->addWidget(mapPreview, 0); |
143 connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked())); |
146 connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked())); |
144 |
147 |
238 bottomLeftLayout->addStretch(1); |
241 bottomLeftLayout->addStretch(1); |
239 |
242 |
240 /* Theme chooser */ |
243 /* Theme chooser */ |
241 |
244 |
242 btnTheme = new QPushButton(); |
245 btnTheme = new QPushButton(); |
|
246 btnTheme->setFlat(true); |
243 connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt())); |
247 connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt())); |
244 m_childWidgets << btnTheme; |
248 m_childWidgets << btnTheme; |
245 bottomLeftLayout->addWidget(btnTheme, 0); |
249 bottomLeftLayout->addWidget(btnTheme, 0); |
246 |
250 |
247 /* Add everything to main layout */ |
251 /* Add everything to main layout */ |
248 |
252 |
249 mainLayout.addLayout(twoColumnLayout, 0); |
253 mainLayout.addWidget(topWidget, 0); |
|
254 mainLayout.addLayout(twoColumnLayout, 1); |
250 |
255 |
251 /* Set defaults */ |
256 /* Set defaults */ |
252 |
257 |
253 setRandomSeed(); |
258 setRandomSeed(); |
254 setMazeSize(0); |
259 setMazeSize(0); |