QTfrontend/ui/widget/mapContainer.cpp
changeset 13228 d23742ccf92b
parent 13212 e9e4cc867b6e
child 13246 0c98d3b249f7
equal deleted inserted replaced
13227:26c739440bef 13228:d23742ccf92b
    96     twoColumnLayout->addLayout(leftLayout, 0);
    96     twoColumnLayout->addLayout(leftLayout, 0);
    97     twoColumnLayout->addStretch(1);
    97     twoColumnLayout->addStretch(1);
    98     twoColumnLayout->addLayout(rightLayout, 0);
    98     twoColumnLayout->addLayout(rightLayout, 0);
    99     QVBoxLayout * drawnControls = new QVBoxLayout();
    99     QVBoxLayout * drawnControls = new QVBoxLayout();
   100 
   100 
       
   101     /* Map type label */
       
   102 
       
   103     QLabel* lblMapType = new QLabel(tr("Map type:"));
       
   104     topLayout->setSpacing(10);
       
   105     topLayout->addWidget(lblMapType, 0);
       
   106     m_childWidgets << lblMapType;
       
   107 
   101     /* Map type combobox */
   108     /* Map type combobox */
   102 
   109 
   103     topLayout->setSpacing(10);
       
   104     topLayout->addWidget(new QLabel(tr("Map type:")), 0);
       
   105     cType = new QComboBox(this);
   110     cType = new QComboBox(this);
   106     topLayout->addWidget(cType, 1);
   111     topLayout->addWidget(cType, 1);
   107     cType->insertItem(0, tr("Image map"), MapModel::StaticMap);
   112     cType->insertItem(0, tr("Image map"), MapModel::StaticMap);
   108     cType->insertItem(1, tr("Mission map"), MapModel::MissionMap);
   113     cType->insertItem(1, tr("Mission map"), MapModel::MissionMap);
   109     cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap);
   114     cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap);
   146     /* Map preview label */
   151     /* Map preview label */
   147 
   152 
   148     QLabel * lblMapPreviewText = new QLabel(this);
   153     QLabel * lblMapPreviewText = new QLabel(this);
   149     lblMapPreviewText->setText(tr("Map preview:"));
   154     lblMapPreviewText->setText(tr("Map preview:"));
   150     leftLayout->addWidget(lblMapPreviewText, 0);
   155     leftLayout->addWidget(lblMapPreviewText, 0);
       
   156     m_childWidgets << lblMapPreviewText;
   151 
   157 
   152     /* Map Preview */
   158     /* Map Preview */
   153 
   159 
   154     mapPreview = new QPushButton(this);
   160     mapPreview = new QPushButton(this);
   155     mapPreview->setObjectName("mapPreview");
   161     mapPreview->setObjectName("mapPreview");
   156     mapPreview->setFlat(true);
   162     mapPreview->setFlat(true);
   157     mapPreview->setFixedSize(256 + 6, 128 + 6);
   163     mapPreview->setFixedSize(256 + 6, 128 + 6);
   158     mapPreview->setContentsMargins(0, 0, 0, 0);
   164     mapPreview->setContentsMargins(0, 0, 0, 0);
   159     leftLayout->addWidget(mapPreview, 0);
   165     leftLayout->addWidget(mapPreview, 0);
   160     connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked()));
   166     connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked()));
       
   167     m_childWidgets << mapPreview;
   161 
   168 
   162     /* Bottom-Left layout */
   169     /* Bottom-Left layout */
   163 
   170 
   164     QVBoxLayout * bottomLeftLayout = new QVBoxLayout();
   171     QVBoxLayout * bottomLeftLayout = new QVBoxLayout();
   165     leftLayout->addLayout(bottomLeftLayout, 1);
   172     leftLayout->addLayout(bottomLeftLayout, 1);
   166 
   173 
   167     /* Map list label */
   174     /* Map list label */
   168 
   175 
   169     lblMapList = new QLabel(this);
   176     lblMapList = new QLabel(this);
   170     rightLayout->addWidget(lblMapList, 0);
   177     rightLayout->addWidget(lblMapList, 0);
       
   178     m_childWidgets << lblMapList;
   171 
   179 
   172     /* Static maps list */
   180     /* Static maps list */
   173 
   181 
   174     staticMapList = new QListView(this);
   182     staticMapList = new QListView(this);
   175     rightLayout->addWidget(staticMapList, 1);
   183     rightLayout->addWidget(staticMapList, 1);
   327     /*QPixmap centered(QSize(m_previewSize.width() - 6, m_previewSize.height() - 6));
   335     /*QPixmap centered(QSize(m_previewSize.width() - 6, m_previewSize.height() - 6));
   328     QPainter pc(&centered);
   336     QPainter pc(&centered);
   329     pc.fillRect(centered.rect(), linearGrad);
   337     pc.fillRect(centered.rect(), linearGrad);
   330     pc.drawPixmap(-3, -3, finalImage);*/
   338     pc.drawPixmap(-3, -3, finalImage);*/
   331 
   339 
   332     mapPreview->setIcon(QIcon(finalImage));
   340     // Set the map preview image. Make sure it is always colored the same,
       
   341     // no matter if disabled or not.
       
   342     QIcon mapPreviewIcon = QIcon();
       
   343     mapPreviewIcon.addPixmap(finalImage, QIcon::Normal);
       
   344     mapPreviewIcon.addPixmap(finalImage, QIcon::Disabled);
       
   345     mapPreview->setIcon(mapPreviewIcon);
   333     mapPreview->setIconSize(finalImage.size());
   346     mapPreview->setIconSize(finalImage.size());
   334 }
   347 }
   335 
   348 
   336 void HWMapContainer::askForGeneratedPreview()
   349 void HWMapContainer::askForGeneratedPreview()
   337 {
   350 {