Esempio n. 1
0
void ButtonEditDialog::openAdvancedDialog(){
    ui->advancedPushButton->setEnabled(false);

    AdvanceButtonDialog *dialog = new AdvanceButtonDialog(button, this);
    dialog->show();

    // Disconnect event to allow for placing slot to AdvanceButtonDialog
    disconnect(this, SIGNAL(keyGrabbed(JoyButtonSlot*)), 0, 0);
    disconnect(this, SIGNAL(selectionCleared()), 0, 0);
    disconnect(this, SIGNAL(selectionFinished()), 0, 0);

    connect(dialog, SIGNAL(finished(int)), ui->virtualKeyMouseTabWidget, SLOT(establishVirtualKeyboardSingleSignalConnections()));
    connect(dialog, SIGNAL(finished(int)), ui->virtualKeyMouseTabWidget, SLOT(establishVirtualMouseSignalConnections()));
    connect(dialog, SIGNAL(finished(int)), this, SLOT(closedAdvancedDialog()));
    connect(dialog, SIGNAL(turboButtonEnabledChange(bool)), this, SLOT(setTurboButtonEnabled(bool)));

    connect(this, SIGNAL(sendTempSlotToAdvanced(JoyButtonSlot*)), dialog, SLOT(placeNewSlot(JoyButtonSlot*)));
    connect(this, SIGNAL(keyGrabbed(JoyButtonSlot*)), dialog, SLOT(placeNewSlot(JoyButtonSlot*)));
    connect(this, SIGNAL(selectionCleared()), dialog, SLOT(clearAllSlots()));
    connect(ui->virtualKeyMouseTabWidget, SIGNAL(selectionMade(JoyButtonSlot*)), dialog, SLOT(placeNewSlot(JoyButtonSlot*)));
    connect(ui->virtualKeyMouseTabWidget, SIGNAL(selectionCleared()), dialog, SLOT(clearAllSlots()));

    connect(this, SIGNAL(finished(int)), dialog, SLOT(close()));
    emit advancedDialogOpened();
}
Esempio n. 2
0
Inventory::~Inventory() {
	delete m_window;
	delete m_descriptionWindow;
	delete m_documentWindow;
	delete m_equipment;
	delete m_currentClone;
	clearAllSlots();
}
Esempio n. 3
0
Spellbook::~Spellbook() {
	m_typeMap.clear();
	delete m_window;
	delete m_weaponWindow;
	delete m_currentModifierClone;
	delete m_currentSpellClone;
	delete m_tabBar;
	clearAllSlots();
}
Esempio n. 4
0
void Spellbook::reload() {
	// reload slots
	clearAllSlots();
	calculateModifierSlots();
	calculateSpellSlots();

	// reload weapon
	m_weaponWindow->reload();
}
Esempio n. 5
0
WeaponWindow::~WeaponWindow()
{
	clearAllSlots();
	delete m_window;
	delete m_currentModifierClone;
	delete m_currentSpellClone;
	delete m_weaponSlot;
	delete m_spellDesc;
}
Esempio n. 6
0
void Inventory::reload() {
	// reload gold
	reloadGold();

	// reload items
	clearAllSlots();
	hideDescription();
	hideDocument();
	m_core->loadItems();
	for (auto& itemData : m_core->getData().items) {
		const Item* item = m_core->getItem(itemData.first);
		if (item == nullptr || m_typeMap.find(item->getType()) == m_typeMap.end()) continue;
		m_typeMap.at(item->getType())->insert({ item->getID(), InventorySlot(*item, itemData.second) });
	}

	calculateSlotPositions(m_consumableItems);
	calculateSlotPositions(m_equipmentItems);
	calculateSlotPositions(m_questItems);
	calculateSlotPositions(m_documentItems);
	calculateSlotPositions(m_miscItems);

	// reload equipment
	m_equipment->reload();
}
AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :
    QDialog(parent, Qt::Dialog),
    ui(new Ui::AdvanceButtonDialog)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);

    this->button = button;
    oldRow = 0;

    if (this->button->getToggleState())
    {
        ui->toggleCheckbox->setChecked(true);
    }

    if (this->button->isUsingTurbo())
    {
        ui->turboCheckbox->setChecked(true);
        ui->turboSlider->setEnabled(true);
    }

    int interval = this->button->getTurboInterval() / 10;
    if (interval < MINIMUMTURBO)
    {
        interval = JoyButton::ENABLEDTURBODEFAULT / 10;
    }
    ui->turboSlider->setValue(interval);
    this->changeTurboText(interval);

    QListIterator<JoyButtonSlot*> iter(*(this->button->getAssignedSlots()));
    while (iter.hasNext())
    {
        JoyButtonSlot *buttonslot = iter.next();
        SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this);
        existingCode->setText(buttonslot->getSlotString());
        existingCode->setValue(buttonslot->getSlotCode(), buttonslot->getSlotCodeAlias(), buttonslot->getSlotMode());

        QListWidgetItem *item = new QListWidgetItem();
        item->setData(Qt::UserRole, QVariant::fromValue<SimpleKeyGrabberButton*>(existingCode));
        QHBoxLayout *layout= new QHBoxLayout();
        layout->setContentsMargins(10, 0, 10, 0);
        layout->addWidget(existingCode);
        QWidget *widget = new QWidget();
        widget->setLayout(layout);
        item->setSizeHint(widget->sizeHint());

        ui->slotListWidget->addItem(item);
        ui->slotListWidget->setItemWidget(item, widget);
        connectButtonEvents(existingCode);
    }

    appendBlankKeyGrabber();
    populateSetSelectionComboBox();

    if (this->button->getSetSelection() > -1 && this->button->getChangeSetCondition() != JoyButton::SetChangeDisabled)
    {
        int selectIndex = (int)this->button->getChangeSetCondition();
        selectIndex += this->button->getSetSelection() * 3;
        if (this->button->getOriginSet() < this->button->getSetSelection())
        {
            selectIndex -= 3;
        }

        ui->setSelectionComboBox->setCurrentIndex(selectIndex);
    }

    fillTimeComboBoxes();
    ui->actionTenthsComboBox->setCurrentIndex(1);

    updateActionTimeLabel();
    changeTurboForSequences();

    if (button->isCycleResetActive())
    {
        ui->autoResetCycleCheckBox->setEnabled(true);
        ui->autoResetCycleCheckBox->setChecked(true);
        checkCycleResetWidgetStatus(true);
    }

    if (button->getCycleResetTime() != 0)
    {
        populateAutoResetInterval();
    }

    updateWindowTitleButtonName();

    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), ui->turboSlider, SLOT(setEnabled(bool)));
    connect(ui->turboSlider, SIGNAL(valueChanged(int)), this, SLOT(checkTurboIntervalValue(int)));

    connect(ui->insertSlotButton, SIGNAL(clicked()), this, SLOT(insertSlot()));
    connect(ui->deleteSlotButton, SIGNAL(clicked()), this, SLOT(deleteSlot()));
    connect(ui->clearAllPushButton, SIGNAL(clicked()), this, SLOT(clearAllSlots()));
    connect(ui->pausePushButton, SIGNAL(clicked()), this, SLOT(insertPauseSlot()));
    connect(ui->holdPushButton, SIGNAL(clicked()), this, SLOT(insertHoldSlot()));
    connect(ui->cyclePushButton, SIGNAL(clicked()), this, SLOT(insertCycleSlot()));
    connect(ui->distancePushButton, SIGNAL(clicked()), this, SLOT(insertDistanceSlot()));
    connect(ui->releasePushButton, SIGNAL(clicked()), this, SLOT(insertReleaseSlot()));

    connect(ui->actionHundredthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionMinutesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionTenthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));

    connect(ui->toggleCheckbox, SIGNAL(clicked(bool)), button, SLOT(setToggle(bool)));
    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), this, SLOT(checkTurboSetting(bool)));

    connect(ui->setSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSetSelection()));
    connect(ui->mouseModPushButton, SIGNAL(clicked()), this, SLOT(insertMouseSpeedModSlot()));

    connect(ui->slotListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(performStatsWidgetRefresh(QListWidgetItem*)));

    connect(ui->actionHundredthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionTenthsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));
    connect(ui->actionMinutesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(checkSlotTimeUpdate()));

    connect(ui->distanceSpinBox, SIGNAL(valueChanged(int)), this, SLOT(checkSlotDistanceUpdate()));
    connect(ui->mouseSpeedModSpinBox, SIGNAL(valueChanged(int)), this, SLOT(checkSlotMouseModUpdate()));
    connect(ui->pressTimePushButton, SIGNAL(clicked()), this, SLOT(insertKeyPressSlot()));
    connect(ui->delayPushButton, SIGNAL(clicked()), this, SLOT(insertDelaySlot()));

    connect(ui->autoResetCycleCheckBox, SIGNAL(clicked(bool)), this, SLOT(checkCycleResetWidgetStatus(bool)));
    connect(ui->autoResetCycleCheckBox, SIGNAL(clicked(bool)), this, SLOT(setButtonCycleReset(bool)));
    connect(ui->resetCycleDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setButtonCycleResetInterval(double)));

    connect(button, SIGNAL(toggleChanged(bool)), ui->toggleCheckbox, SLOT(setChecked(bool)));
    connect(button, SIGNAL(turboChanged(bool)), this, SLOT(checkTurboSetting(bool)));
}
Esempio n. 8
0
AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :
    QDialog(parent, Qt::Window),
    ui(new Ui::AdvanceButtonDialog)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);

    this->button = button;
    oldRow = 0;

    if (this->button->getToggleState())
    {
        ui->toggleCheckbox->setChecked(true);
    }

    if (this->button->isUsingTurbo())
    {
        ui->turboCheckbox->setChecked(true);
        ui->turboSlider->setEnabled(true);
    }

    int interval = this->button->getTurboInterval() / 10;
    if (interval < MINIMUMTURBO)
    {
        interval = JoyButton::ENABLEDTURBODEFAULT / 10;
    }
    ui->turboSlider->setValue(interval);
    this->changeTurboText(interval);

    QListIterator<JoyButtonSlot*> iter(*(this->button->getAssignedSlots()));
    while (iter.hasNext())
    {
        JoyButtonSlot *buttonslot = iter.next();
        SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this);
        existingCode->setText(buttonslot->getSlotString());
        existingCode->setValue(buttonslot->getSlotCode(), buttonslot->getSlotMode());

        //existingCode->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

        connectButtonEvents(existingCode);
        QListWidgetItem *item = new QListWidgetItem();
        ui->slotListWidget->addItem(item);

        item->setData(Qt::UserRole, QVariant::fromValue<SimpleKeyGrabberButton*>(existingCode));
        QHBoxLayout *layout= new QHBoxLayout();
        layout->addWidget(existingCode);
        QWidget *widget = new QWidget();
        widget->setLayout(layout);
        item->setSizeHint(widget->sizeHint());
        ui->slotListWidget->setItemWidget(item, widget);
    }

    appendBlankKeyGrabber();

    if (this->button->getSetSelection() > -1 && this->button->getChangeSetCondition() != JoyButton::SetChangeDisabled)
    {
        int offset = (int)this->button->getChangeSetCondition();
        ui->setSelectionComboBox->setCurrentIndex((this->button->getSetSelection() * 3) + offset);
    }

    if (this->button->getOriginSet() == 0)
    {
        ui->setSelectionComboBox->model()->removeRows(1, 3);
    }
    else if (this->button->getOriginSet() == 1)
    {
        ui->setSelectionComboBox->model()->removeRows(4, 3);
    }
    else if (this->button->getOriginSet() == 2)
    {
        ui->setSelectionComboBox->model()->removeRows(7, 3);
    }
    else if (this->button->getOriginSet() == 3)
    {
        ui->setSelectionComboBox->model()->removeRows(10, 3);
    }
    else if (this->button->getOriginSet() == 4)
    {
        ui->setSelectionComboBox->model()->removeRows(13, 3);
    }
    else if (this->button->getOriginSet() == 5)
    {
        ui->setSelectionComboBox->model()->removeRows(16, 3);
    }
    else if (this->button->getOriginSet() == 6)
    {
        ui->setSelectionComboBox->model()->removeRows(19, 3);
    }
    else if (this->button->getOriginSet() == 7)
    {
        ui->setSelectionComboBox->model()->removeRows(22, 3);
    }

    updateActionTimeLabel();
    changeTurboForSequences();

    setWindowTitle(tr("Advanced").append(": ").append(button->getPartialName()));

    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), ui->turboSlider, SLOT(setEnabled(bool)));
    connect(ui->turboSlider, SIGNAL(valueChanged(int)), this, SLOT(checkTurboIntervalValue(int)));

    connect(ui->insertSlotButton, SIGNAL(clicked()), this, SLOT(insertSlot()));
    connect(ui->deleteSlotButton, SIGNAL(clicked()), this, SLOT(deleteSlot()));
    connect(ui->clearAllPushButton, SIGNAL(clicked()), this, SLOT(clearAllSlots()));
    connect(ui->pausePushButton, SIGNAL(clicked()), this, SLOT(insertPauseSlot()));
    connect(ui->holdPushButton, SIGNAL(clicked()), this, SLOT(insertHoldSlot()));
    connect(ui->cyclePushButton, SIGNAL(clicked()), this, SLOT(insertCycleSlot()));
    connect(ui->distancePushButton, SIGNAL(clicked()), this, SLOT(insertDistanceSlot()));
    connect(ui->releasePushButton, SIGNAL(clicked()), this, SLOT(insertReleaseSlot()));

    connect(ui->actionSecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));
    connect(ui->actionMillisecondsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateActionTimeLabel()));

    connect(ui->toggleCheckbox, SIGNAL(clicked(bool)), button, SLOT(setToggle(bool)));
    connect(ui->turboCheckbox, SIGNAL(clicked(bool)), this, SLOT(checkTurboSetting(bool)));

    connect(ui->setSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSetSelection()));

    connect(button, SIGNAL(toggleChanged(bool)), ui->toggleCheckbox, SLOT(setChecked(bool)));
    connect(button, SIGNAL(turboChanged(bool)), this, SLOT(checkTurboSetting(bool)));
}
Esempio n. 9
0
void WeaponWindow::reload()
{
	m_requireReload = false;
	// reload slot and text
	delete m_weaponSlot;
	m_weapon = m_core->getWeapon();
	if (m_weapon == nullptr)
	{
		m_weaponSlot = new InventorySlot(g_resourceManager->getTexture(ResourceID::Texture_equipmentplaceholders), sf::Vector2i(0, 0));
		m_weaponName.setString(g_textProvider->getText("NoWeapon"));
		m_weaponDescription.setString("");
	}
	else
	{
		m_weaponSlot = new InventorySlot(*m_weapon, -1);
		m_weaponName.setString(g_textProvider->getText(m_weapon->getID()));
		m_weaponDescription.setString(g_textProvider->getCroppedText(m_weapon->getDescription(), GUIConstants::CHARACTER_SIZE_M,
			static_cast<int>(WIDTH - (GUIConstants::TEXT_OFFSET + 2 * MARGIN + InventorySlot::SIDE_LENGTH))));
	}
	m_weaponSlot->setPosition(sf::Vector2f(LEFT + GUIConstants::TEXT_OFFSET, TOP + GUIConstants::TEXT_OFFSET));

	clearAllSlots();

	if (m_weapon == nullptr) return;

	float xOffset = LEFT + GUIConstants::TEXT_OFFSET;
	float yOffset = m_weaponSlot->getPosition().y + 2 * InventorySlot::SIDE_LENGTH;
	int slotNr = 0;
	for (auto& it : m_weapon->getWeaponSlots())
	{
		SpellSlot spellSlot = SpellSlot();
		if (it.first.second == SpellID::VOID)
		{
			spellSlot = SpellSlot(it.first.first);
		}
		else
		{
			spellSlot = SpellSlot(it.first.second);
		}
		spellSlot.setPosition(sf::Vector2f(xOffset, yOffset) + sf::Vector2f(SpellSlot::RADIUS, SpellSlot::RADIUS));
		spellSlot.setNr(slotNr);
		xOffset += 2 * SpellSlot::RADIUS + 2 * MARGIN;

		std::vector<ModifierSlot> modifiers;
		for (auto& it2 : it.second.second)
		{
			modifiers.push_back(ModifierSlot(it2.second));
		}
		int emptyModifierCount = it.second.first - static_cast<int>(modifiers.size());
		for (int i = 0; i < emptyModifierCount; i++)
		{
			modifiers.push_back(ModifierSlot());
		}
		for (auto& it2 : modifiers)
		{
			it2.setPosition(sf::Vector2f(xOffset, yOffset));
			it2.setNr(slotNr);
			xOffset += ModifierSlot::SIDE_LENGTH + MARGIN;
		}

		yOffset += 2 * SpellSlot::RADIUS + 2 * MARGIN;
		xOffset = LEFT + GUIConstants::TEXT_OFFSET;
		slotNr++;
		m_weaponSlots.push_back(std::pair<SpellSlot, std::vector<ModifierSlot>>({spellSlot, modifiers}));
	}
}