The maximum number for items has been raised to 999

This commit is contained in:
TuxSH
2015-09-13 18:43:33 +02:00
parent 25174e4dd1
commit 520ad38694
8 changed files with 169 additions and 140 deletions

View File

@@ -91,12 +91,11 @@ void ItemPocketEditor::setEditedItem(LibPkmGC::Item const & val){
}
void ItemPocketEditor::updateMaxQuantity(void) {
const int maxqty[] = { 0, 99, 99, 99, 99, 1, 99, 1 };
const int maxqtyPC[] = { 0, 999, 999, 999, 999, 1, 999, 1 };
const int maxqty[] = { 0, 999, 999, 999, 999, 1, 999, 1 };
ItemCategoryIndex ctgy = getItemCategory(itemNameFld->currentItemIndex(), isXD);
quantityFld->setRange(0, (flags == GIVABLE_ITEMS_ALLOWED) ? maxqtyPC[(size_t)ctgy] : maxqty[(size_t)ctgy]);
quantityFld->setDisabled(maxqty[(size_t)ctgy] == 0);
quantityFld->setRange(0, maxqty[ctgy]);
quantityFld->setDisabled(maxqty[ctgy] == 0);
}
void ItemPocketEditor::displayItem(void) {
QTableWidgetItem *it = tbl->currentItem();

View File

@@ -102,16 +102,16 @@ MainWindow::MainWindow() : QMainWindow(), centralWidget(new MWCentralWidget) {
optionsMenu = menuBar()->addMenu(tr("&Options"));
interfaceLangSubMenu = optionsMenu->addMenu(tr("&Interface language"));
dumpedNamesLangSubMenu = optionsMenu->addMenu(tr("&Dumped names language"));
ignoreDataCorruptionAction = new QAction(this);
ignoreDataCorruptionAction->setCheckable(true);
optionsMenu->addAction(ignoreDataCorruptionAction);
setCentralWidget(centralWidget);
connect(openFileAction, SIGNAL(triggered()), this, SLOT(openSaveFile()));
connect(saveFileAction, SIGNAL(triggered()), this, SLOT(saveSaveFile()));
connect(saveFileAsAction, SIGNAL(triggered()), this, SLOT(saveSaveFileAs()));
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
loadSettings();
ignoreDataCorruptionAction->setChecked(ignoreDataCorruption);
createInterfaceLanguageMenu();
createDumpedNamesLanguageMenu();
interfaceLanguageChanged(interfaceLangGroup->checkedAction());
@@ -121,6 +121,12 @@ MainWindow::MainWindow() : QMainWindow(), centralWidget(new MWCentralWidget) {
saveFileAction->setDisabled(true);
saveFileAsAction->setDisabled(true);
connect(openFileAction, SIGNAL(triggered()), this, SLOT(openSaveFile()));
connect(saveFileAction, SIGNAL(triggered()), this, SLOT(saveSaveFile()));
connect(saveFileAsAction, SIGNAL(triggered()), this, SLOT(saveSaveFileAs()));
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
connect(ignoreDataCorruptionAction, SIGNAL(triggered()), this, SLOT(changeIgnoreDataCorruptionStatus()));
}
void MainWindow::createDumpedNamesLanguageMenu(void) {
@@ -209,6 +215,8 @@ void MainWindow::updateText(void) {
for (QList<QAction*>::iterator it = actions2.begin() + 1; it != actions2.end(); ++it)
(*it)->setText(VersionInfoLayout::languageNames()[(*it)->data().toInt()]);
ignoreDataCorruptionAction->setText(tr("Ignore data corruption"));
}
@@ -243,7 +251,6 @@ QString MainWindow::loadInterfaceLanguage(QString const& language) {
switchTranslator(translator, fileName);
switchTranslator(translatorQt, langPath + QString("qt_%1.qm").arg(lg)); // Note that qt_en.qm does not exist, which is normal :)
switchTranslator(translatorQt, langPath + QString("qtbase_%1.qm").arg(lg)); // For Qt > 5.3
updateText();
@@ -258,6 +265,10 @@ void MainWindow::dumpedNamesLanguageChanged(QAction* action) {
if (action != NULL) dumpedNamesLanguage = (LanguageIndex)action->data().toInt();
}
void MainWindow::changeIgnoreDataCorruptionStatus(void) {
ignoreDataCorruption = ignoreDataCorruptionAction->isChecked();
}
void MainWindow::changeEvent(QEvent* ev) {
if (ev == NULL) return;
switch (ev->type()) {

View File

@@ -73,6 +73,7 @@ public slots:
void interfaceLanguageChanged(QAction* action);
void dumpedNamesLanguageChanged(QAction* action);
void changeIgnoreDataCorruptionStatus(void);
protected:
@@ -92,11 +93,11 @@ private:
QAction *openFileAction, *saveFileAction, *saveFileAsAction, *exitAction;
QMenu *optionsMenu;
QAction* ignoreDataCorruptionAction;
QMenu* interfaceLangSubMenu;
QActionGroup *interfaceLangGroup;
QMenu* dumpedNamesLangSubMenu;
QActionGroup *dumpedNamesLangGroup;
QAction* ignoreDataCorruptionAction;
QSettings *settings;
QTranslator translator, translatorQt;