RocketOptionsDialog::RocketOptionsDialog(QWidget *parent) : QDialog(parent) { setupUi(this); positionGroup.addButton(radPosition1, 1); positionGroup.addButton(radPosition2, 2); positionGroup.addButton(radPosition3, 3); positionGroup.addButton(radPosition4, 4); positionGroup.addButton(radPosition5, 5); positionGroup.addButton(radPosition6, 6); positionGroup.addButton(radPosition7, 7); positionGroup.addButton(radPosition8, 8); positionGroup.addButton(radPosition9, 9); connect(&positionGroup, SIGNAL(buttonClicked(int)), SLOT(positionClicked(int))); QSettings settings; settings.beginGroup("thumbnail"); chkAlwaysMakeThumbnails->setChecked(settings.value("alwaysMakeThumbnails").toBool()); settings.endGroup(); settings.beginGroup("ui"); chkAskBeforeDeleting->setChecked(settings.value("askBeforeDeleting").toBool()); chkUseFading->setChecked(settings.value("useFading").toBool()); chkShowRollover->setChecked(settings.value("showRollover").toBool()); chkCenterOnSelection->setChecked(settings.value("centerOnSelection").toBool()); settings.endGroup(); spnRamForImages->setValue(settings.value("image/ramForImages").toInt()); chkCheckForUpdates->setChecked(settings.value("program/checkForUpdates").toBool()); settings.beginGroup("watermark"); watermarkFont = settings.value("font").value< QFont >(); QFont textFont = watermarkFont; textFont.setPointSize(txtWatermarkText->font().pointSize()); txtWatermarkText->setFont(textFont); //disregard point size spnMargin->setValue(settings.value("margin").toInt()); txtWatermarkText->setPlainText(settings.value("text").toString()); if (settings.value("selected").toString() == "text") { radWatermarkText->setChecked(true); } else { radImage->setChecked(true); } if (QFile(settings.value("image").toString()).exists()) { linImage->setText(settings.value("image").toString()); } chkAddWatermark->setChecked(settings.value("on").toBool()); positionGroup.button(settings.value("position").toInt())->setChecked(true); watermarkColor = settings.value("color").value< QColor >(); QColor buttonColor = watermarkColor; buttonColor.setAlpha(255); setColorButtonColor(buttonColor); //disregard alpha sldOpacity->setValue(watermarkColor.alpha()); settings.endGroup(); connect(btnColor, SIGNAL(clicked()), SLOT(colorClicked())); connect(sldOpacity, SIGNAL(valueChanged(int)), SLOT(opacityChanged())); connect(btnFont, SIGNAL(clicked()), SLOT(fontClicked())); connect(btnImageSelect, SIGNAL(clicked()), SLOT(imageSelectClicked())); connect(btnPreview, SIGNAL(clicked()), SLOT(previewClicked())); }
HWMapContainer::HWMapContainer(QWidget * parent) : QWidget(parent), mainLayout(this), pMap(0), mapgen(MAPGEN_REGULAR), m_previewSize(256, 128) { // don't show preview anything until first show event m_previewEnabled = false; m_missionsViewSetup = false; m_staticViewSetup = false; m_script = QString(); hhSmall.load(":/res/hh_small.png"); hhLimit = 18; templateFilter = 0; m_master = true; linearGrad = QLinearGradient(QPoint(128, 0), QPoint(128, 128)); linearGrad.setColorAt(1, QColor(0, 0, 192)); linearGrad.setColorAt(0, QColor(66, 115, 225)); mainLayout.setContentsMargins(HWApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin), 10, HWApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin), HWApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin)); m_staticMapModel = DataManager::instance().staticMapModel(); m_missionMapModel = DataManager::instance().missionMapModel(); m_themeModel = DataManager::instance().themeModel(); /* Layouts */ QWidget * topWidget = new QWidget(); QHBoxLayout * topLayout = new QHBoxLayout(topWidget); topWidget->setContentsMargins(0, 0, 0, 0); topLayout->setContentsMargins(0, 0, 0, 0); QHBoxLayout * twoColumnLayout = new QHBoxLayout(); QVBoxLayout * leftLayout = new QVBoxLayout(); QVBoxLayout * rightLayout = new QVBoxLayout(); twoColumnLayout->addLayout(leftLayout, 0); twoColumnLayout->addStretch(1); twoColumnLayout->addLayout(rightLayout, 0); QVBoxLayout * drawnControls = new QVBoxLayout(); /* Map type combobox */ topLayout->setSpacing(10); topLayout->addWidget(new QLabel(tr("Map type:")), 0); cType = new QComboBox(this); topLayout->addWidget(cType, 1); cType->insertItem(0, tr("Image map"), MapModel::StaticMap); cType->insertItem(1, tr("Mission map"), MapModel::MissionMap); cType->insertItem(2, tr("Hand-drawn"), MapModel::HandDrawnMap); cType->insertItem(3, tr("Randomly generated"), MapModel::GeneratedMap); cType->insertItem(4, tr("Random maze"), MapModel::GeneratedMaze); cType->insertItem(5, tr("Random perlin"), MapModel::GeneratedPerlin); connect(cType, SIGNAL(currentIndexChanged(int)), this, SLOT(mapTypeChanged(int))); m_childWidgets << cType; /* Randomize button */ topLayout->addStretch(1); const QIcon& lp = QIcon(":/res/dice.png"); QSize sz = lp.actualSize(QSize(65535, 65535)); btnRandomize = new QPushButton(); btnRandomize->setText(tr("Random")); btnRandomize->setIcon(lp); btnRandomize->setFixedHeight(30); btnRandomize->setIconSize(sz); btnRandomize->setFlat(true); btnRandomize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(btnRandomize, SIGNAL(clicked()), this, SLOT(setRandomMap())); m_childWidgets << btnRandomize; btnRandomize->setStyleSheet("padding: 5px;"); btnRandomize->setFixedHeight(cType->height()); topLayout->addWidget(btnRandomize, 1); /* Seed button */ btnSeed = new QPushButton(parentWidget()->parentWidget()); btnSeed->setText(tr("Seed")); btnSeed->setStyleSheet("padding: 5px;"); btnSeed->setFixedHeight(cType->height()); connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt())); topLayout->addWidget(btnSeed, 0); /* Map preview label */ QLabel * lblMapPreviewText = new QLabel(this); lblMapPreviewText->setText(tr("Map preview:")); leftLayout->addWidget(lblMapPreviewText, 0); /* Map Preview */ mapPreview = new QPushButton(this); mapPreview->setObjectName("mapPreview"); mapPreview->setFlat(true); mapPreview->setFixedSize(256 + 6, 128 + 6); mapPreview->setContentsMargins(0, 0, 0, 0); leftLayout->addWidget(mapPreview, 0); connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked())); /* Bottom-Left layout */ QVBoxLayout * bottomLeftLayout = new QVBoxLayout(); leftLayout->addLayout(bottomLeftLayout, 1); /* Map list label */ lblMapList = new QLabel(this); rightLayout->addWidget(lblMapList, 0); /* Static maps list */ staticMapList = new QListView(this); rightLayout->addWidget(staticMapList, 1); m_childWidgets << staticMapList; /* Mission maps list */ missionMapList = new QListView(this); rightLayout->addWidget(missionMapList, 1); m_childWidgets << missionMapList; /* Map load and edit buttons */ drawnControls->addStretch(1); btnLoadMap = new QPushButton(tr("Load map drawing")); btnLoadMap->setStyleSheet("padding: 20px;"); drawnControls->addWidget(btnLoadMap, 0); m_childWidgets << btnLoadMap; connect(btnLoadMap, SIGNAL(clicked()), this, SLOT(loadDrawing())); btnEditMap = new QPushButton(tr("Edit map drawing")); btnEditMap->setStyleSheet("padding: 20px;"); drawnControls->addWidget(btnEditMap, 0); m_childWidgets << btnEditMap; connect(btnEditMap, SIGNAL(clicked()), this, SIGNAL(drawMapRequested())); drawnControls->addStretch(1); rightLayout->addLayout(drawnControls); /* Generator style list */ generationStyles = new QListWidget(this); new QListWidgetItem(tr("All"), generationStyles); new QListWidgetItem(tr("Small"), generationStyles); new QListWidgetItem(tr("Medium"), generationStyles); new QListWidgetItem(tr("Large"), generationStyles); new QListWidgetItem(tr("Cavern"), generationStyles); new QListWidgetItem(tr("Wacky"), generationStyles); connect(generationStyles, SIGNAL(currentRowChanged(int)), this, SLOT(setTemplateFilter(int))); m_childWidgets << generationStyles; rightLayout->addWidget(generationStyles, 1); /* Maze style list */ mazeStyles = new QListWidget(this); new QListWidgetItem(tr("Small tunnels"), mazeStyles); new QListWidgetItem(tr("Medium tunnels"), mazeStyles); new QListWidgetItem(tr("Large tunnels"), mazeStyles); new QListWidgetItem(tr("Small islands"), mazeStyles); new QListWidgetItem(tr("Medium islands"), mazeStyles); new QListWidgetItem(tr("Large islands"), mazeStyles); connect(mazeStyles, SIGNAL(currentRowChanged(int)), this, SLOT(setMazeSize(int))); m_childWidgets << mazeStyles; rightLayout->addWidget(mazeStyles, 1); /* Mission description */ lblDesc = new QLabel(); lblDesc->setWordWrap(true); lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); lblDesc->setAlignment(Qt::AlignTop | Qt::AlignLeft); lblDesc->setStyleSheet("font: 10px;"); bottomLeftLayout->addWidget(lblDesc, 100); /* Add stretch above theme button */ bottomLeftLayout->addStretch(1); /* Theme chooser */ btnTheme = new QPushButton(this); btnTheme->setFlat(true); connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt())); m_childWidgets << btnTheme; bottomLeftLayout->addWidget(btnTheme, 0); /* Add everything to main layout */ mainLayout.addWidget(topWidget, 0); mainLayout.addLayout(twoColumnLayout, 1); /* Set defaults */ setRandomSeed(); setMazeSize(0); setTemplateFilter(0); staticMapChanged(m_staticMapModel->index(0, 0)); missionMapChanged(m_missionMapModel->index(0, 0)); changeMapType(MapModel::GeneratedMap); }
/* Constructor */ ModFrame::ModFrame(FilterWin *parent) : QFrame(parent), filterWin(parent) { // base layout QVBoxLayout * layout = new QVBoxLayout; QVBoxLayout * vbox; QHBoxLayout * hbox; QFrame * frame; int i; // mode div frame = new QFrame; vbox = new QVBoxLayout; frame->setLayout(vbox); addLabelRow(vbox, "Mode:"); hbox = new QHBoxLayout; modeRadios[MOVIESOAP_SKIP] = addRadio(hbox, "&Skip"); modeRadios[MOVIESOAP_MUTE] = addRadio(hbox, "&Mute"); modeRadios[MOVIESOAP_BLACKOUT] = addRadio(hbox, "&Blackout"); QPushButton *blackoutButton = addButton(hbox, "S&et blackout bounds"); connect( blackoutButton, SIGNAL(clicked()), this, SLOT(blackoutClicked()) ); vbox->addLayout(hbox); layout->addWidget(frame); // time div addLabelRow(layout, "Time:"); hbox = new QHBoxLayout; hbox->addWidget(new QLabel(tr("from"))); startText = addText(hbox, "00:00:00.00"); startText->setFixedWidth(110); hbox->addWidget(new QLabel(tr("to"))); stopText = addText(hbox, "00:00:00.00"); stopText->setFixedWidth(110); hbox->addWidget(new QLabel(tr("title"))); titleText = addText(hbox, "-1"); titleText->setFixedWidth(50); layout->addLayout(hbox); // severity/tolerance div frame = new QFrame; vbox = new QVBoxLayout; frame->setLayout(vbox); addLabel(vbox, "Offensiveness (scarcely <-> very)"); hbox = new QHBoxLayout; for (i = 0; i < MOVIESOAP_TOLERANCE_COUNT-1; i++) { severityRadios[i] = addRadio(hbox); } vbox->addLayout(hbox); layout->addWidget(frame); // category div hbox = new QHBoxLayout; addLabel(hbox, "Category:"); categoryBox = new QComboBox; for (i = 0; i < MOVIESOAP_CAT_COUNT; i ++) { categoryBox->addItem(QString(toleranceLabels[i]), QVariant(i)); } hbox->addWidget(categoryBox); layout->addLayout(hbox); // description div hbox = new QHBoxLayout; addLabel(hbox, "Description:"); descText = addText(hbox, "e.g. skip shootout scene"); layout->addLayout(hbox); // Submit div hbox = new QHBoxLayout; QPushButton * okButton = addButton(hbox, "&Ok"); QPushButton * cancelButton = addButton(hbox, "<< (&cancel)"); layout->addLayout(hbox); connect( okButton, SIGNAL(clicked()), this, SLOT(okClicked()) ); connect( cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()) ); hbox = new QHBoxLayout; QPushButton * previewButton = addButton(hbox, "&Preview edit"); layout->addLayout(hbox); connect( previewButton, SIGNAL(clicked()), this, SLOT(previewClicked()) ); // finish hbox = new QHBoxLayout; layout->addLayout(hbox, 9); setLayout(layout); }