135 |
135 |
136 /* Seed button */ |
136 /* Seed button */ |
137 |
137 |
138 btnSeed = new QPushButton(parentWidget()->parentWidget()); |
138 btnSeed = new QPushButton(parentWidget()->parentWidget()); |
139 btnSeed->setText(tr("Seed")); |
139 btnSeed->setText(tr("Seed")); |
|
140 btnSeed->setWhatsThis(tr("View and edit the seed, the source of randomness in the game")); |
140 btnSeed->setStyleSheet("padding: 5px;"); |
141 btnSeed->setStyleSheet("padding: 5px;"); |
141 btnSeed->setFixedHeight(cType->height()); |
142 btnSeed->setFixedHeight(cType->height()); |
142 connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt())); |
143 connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt())); |
143 topLayout->addWidget(btnSeed, 0); |
144 topLayout->addWidget(btnSeed, 0); |
144 |
145 |
253 |
254 |
254 /* Theme chooser */ |
255 /* Theme chooser */ |
255 QHBoxLayout * themeHBox = new QHBoxLayout(this); |
256 QHBoxLayout * themeHBox = new QHBoxLayout(this); |
256 |
257 |
257 btnRandTheme = new QPushButton(); |
258 btnRandTheme = new QPushButton(); |
|
259 btnRandTheme->setWhatsThis(tr("Randomize the theme")); |
258 btnRandTheme->setIcon(lp); |
260 btnRandTheme->setIcon(lp); |
259 btnRandTheme->setIconSize(QSize(24, 24)); |
261 btnRandTheme->setIconSize(QSize(24, 24)); |
260 btnRandTheme->setFixedHeight(30); |
262 btnRandTheme->setFixedHeight(30); |
261 btnRandTheme->setFixedWidth(30); |
263 btnRandTheme->setFixedWidth(30); |
262 connect(btnRandTheme, SIGNAL(clicked()), this, SLOT(setRandomTheme())); |
264 connect(btnRandTheme, SIGNAL(clicked()), this, SLOT(setRandomTheme())); |
263 m_childWidgets << btnTheme; |
265 m_childWidgets << btnTheme; |
264 themeHBox->addWidget(btnRandTheme, 0); |
266 themeHBox->addWidget(btnRandTheme, 0); |
265 |
267 |
266 btnTheme = new QPushButton(this); |
268 btnTheme = new QPushButton(this); |
|
269 btnTheme->setWhatsThis(tr("Choose a theme")); |
267 btnTheme->setFlat(true); |
270 btnTheme->setFlat(true); |
268 btnTheme->setIconSize(QSize(30, 30)); |
271 btnTheme->setIconSize(QSize(30, 30)); |
269 btnTheme->setFixedHeight(30); |
272 btnTheme->setFixedHeight(30); |
270 btnTheme->setMaximumWidth(222); |
273 btnTheme->setMaximumWidth(222); |
271 connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt())); |
274 connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt())); |
792 void HWMapContainer::mapTypeChanged(int index) |
795 void HWMapContainer::mapTypeChanged(int index) |
793 { |
796 { |
794 changeMapType((MapModel::MapType)cType->itemData(index).toInt()); |
797 changeMapType((MapModel::MapType)cType->itemData(index).toInt()); |
795 } |
798 } |
796 |
799 |
|
800 void HWMapContainer::updateHelpTexts(MapModel::MapType type) |
|
801 { |
|
802 QString randomAll = tr("Randomize the map, theme and seed"); |
|
803 QString randomNoMap = tr("Randomize the theme and seed"); |
|
804 QString randomSeed = tr("Randomize the seed"); |
|
805 QString randomAllPrev = tr("Click to randomize the map, theme and seed"); |
|
806 QString randomNoMapPrev = tr("Click to randomize the theme and seed"); |
|
807 QString mfsComplex = QString(tr("Complexity of the generated map (current: %1)")).arg(mapFeatureSize->value()); |
|
808 int fortDistance = cBaseFortDistance + mapFeatureSize->value() * cFortDistanceUnit; |
|
809 QString mfsFortsDistance = QString(tr("Distance between forts (current: %1)")).arg(fortDistance); |
|
810 switch (type) |
|
811 { |
|
812 case MapModel::GeneratedMap: |
|
813 case MapModel::GeneratedPerlin: |
|
814 case MapModel::GeneratedMaze: |
|
815 mapPreview->setWhatsThis(randomAllPrev); |
|
816 mapFeatureSize->setWhatsThis(mfsComplex); |
|
817 btnRandomize->setWhatsThis(randomAll); |
|
818 break; |
|
819 case MapModel::MissionMap: |
|
820 case MapModel::StaticMap: |
|
821 mapPreview->setWhatsThis(randomAllPrev); |
|
822 btnRandomize->setWhatsThis(randomAll); |
|
823 break; |
|
824 case MapModel::HandDrawnMap: |
|
825 mapPreview->setWhatsThis(tr("Click to edit")); |
|
826 btnRandomize->setWhatsThis(randomSeed); |
|
827 break; |
|
828 case MapModel::FortsMap: |
|
829 mapPreview->setWhatsThis(randomNoMapPrev); |
|
830 mapFeatureSize->setWhatsThis(mfsFortsDistance); |
|
831 btnRandomize->setWhatsThis(randomNoMap); |
|
832 break; |
|
833 default: |
|
834 break; |
|
835 } |
|
836 } |
|
837 |
|
838 |
797 void HWMapContainer::changeMapType(MapModel::MapType type, const QModelIndex & newMap) |
839 void HWMapContainer::changeMapType(MapModel::MapType type, const QModelIndex & newMap) |
798 { |
840 { |
799 staticMapList->hide(); |
841 staticMapList->hide(); |
800 missionMapList->hide(); |
842 missionMapList->hide(); |
801 lblMapList->hide(); |
843 lblMapList->hide(); |
868 } |
910 } |
869 |
911 |
870 // Update theme button size |
912 // Update theme button size |
871 updateThemeButtonSize(); |
913 updateThemeButtonSize(); |
872 |
914 |
|
915 // Update “What's This?” help texts |
|
916 updateHelpTexts(type); |
|
917 |
873 // Update cType combobox |
918 // Update cType combobox |
874 for (int i = 0; i < cType->count(); i++) |
919 for (int i = 0; i < cType->count(); i++) |
875 { |
920 { |
876 if ((MapModel::MapType)cType->itemData(i).toInt() == type) |
921 if ((MapModel::MapType)cType->itemData(i).toInt() == type) |
877 { |
922 { |
886 } |
931 } |
887 |
932 |
888 void HWMapContainer::intSetFeatureSize(int val) |
933 void HWMapContainer::intSetFeatureSize(int val) |
889 { |
934 { |
890 mapFeatureSize->setValue(val); |
935 mapFeatureSize->setValue(val); |
|
936 updateHelpTexts((MapModel::MapType)cType->itemData(cType->currentIndex()).toInt()); |
891 emit mapFeatureSizeChanged(val); |
937 emit mapFeatureSizeChanged(val); |
892 } |
938 } |
893 void HWMapContainer::setFeatureSize(int val) |
939 void HWMapContainer::setFeatureSize(int val) |
894 { |
940 { |
895 m_mapFeatureSize = val; |
941 m_mapFeatureSize = val; |