Esempio n. 1
0
OptionsTab::OptionsTab( DFManagerPtr manager, QWidget * parent )
    : QWidget(parent)
    , ui(new Ui::OptionsTab)
    , m_dataManager(manager)
{
    ui->setupUi(this);

    // Options Group
    QGridLayout *options_layout = new QGridLayout(this);
    ui->optionsGroup->setLayout(options_layout);
    QStringList options;
    QStringList labels;
    options << "ECONOMY" << "TEMPERATURE" << "WEATHER" << "CAVEINS" << "INVADERS" << "SHOW_FLOW_AMOUNTS";
    labels << "Economy" << "Temperature" << "Weather" << "Cave-ins" << "Invaders" << "Liquid Depth";
    Q_ASSERT( options.length() == labels.length() );
    for( int i = 0; i < options.length(); ++i ) {
        ConfigButton* b = new ConfigButton(options.at(i), labels.at(i), this);
        options_layout->addWidget(b, i/2, i%2); // 2 is the number of columns
    }

    NumericOptionWidget* num_opt = new NumericOptionWidget("POPULATION_CAP", "Population Cap", 1, []() {QList<int> l; l << 999; return l;} (), this);
    num_opt->setTooltips(QStringList("Population Cap"));
    options_layout->addWidget(num_opt, options.length()/2, options.length()%2);

    num_opt = new NumericOptionWidget("BABY_CHILD_CAP", "Child Cap", 2, []() {QList<int> l; l << 999 << 9999; return l;}(), this);
    num_opt->setTooltips([this]() { QStringList l; l << tr("Absolute cap on the number of babies+children") << tr("New child cap as percentage of total population"); return l;}());
    options_layout->addWidget(num_opt, (options.length()+1)/2, (1+options.length())%2);

    // Mods Group
    m_aquifersButton = new QPushButton(tr("Aquifers: ") + DwarfFortress::instance().rawsFind("[AQUIFER]"));
    if (DwarfFortress::instance().rawsFind("[PET_EXOTIC]") == "YES") {
        m_exoticButton = new QPushButton(tr("Exotic Animals: ") + DwarfFortress::instance().rawsFind("[PET_EXOTIC]"));
    } else {
        m_exoticButton = new QPushButton(tr("Exotic Animals: ") + DwarfFortress::instance().rawsFind("[MOUNT_EXOTIC]"));
    }
    connect(m_aquifersButton, SIGNAL(pressed()), this, SLOT(aquifiersPressed()));
    connect(m_exoticButton, SIGNAL(pressed()), this, SLOT(exoticPressed()));

    QHBoxLayout *box = new QHBoxLayout(ui->modsGroup);
    box->addWidget(m_aquifersButton);
    box->addWidget(m_exoticButton);
    ui->modsGroup->setLayout(box);

    //Keybinds Group
    ui->keybindingsGroup->setLayout(new QHBoxLayout(ui->keybindingsGroup));
    ui->keybindingsGroup->layout()->addWidget(new KeybindsWidget(ui->keybindingsGroup));

    connect( &DwarfFortress::instance(), SIGNAL( dataChanged() ), this, SLOT( dfDataChanged() ));
    connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(defaultsPressed()));
}
Esempio n. 2
0
void LightSettings::restoreDefaultValues(bool /*all*/)
{
	defaultsPressed();
	setColor(color_sample, ColorRGBA(255,255,255));
	lights_list->setCurrentItem(0);
}