Refactored General Settings Tab

~ Removed some heap allocs
~ Remaining heap allocs are needed.
~ Unrolled "one line" declarations in header
~ restructured logic in GeneralSettingsPage

Refactored Appearance Tab

- removed some heap allocs
- removed setting of zone view, its not needed here, its configurable in
real time, in game.
This commit is contained in:
Matt Lowe 2015-01-16 01:34:03 +01:00
parent 9b7f488bd7
commit 4b45ba46f4
2 changed files with 113 additions and 108 deletions

View file

@ -29,18 +29,16 @@
GeneralSettingsPage::GeneralSettingsPage() GeneralSettingsPage::GeneralSettingsPage()
{ {
languageLabel = new QLabel;
languageBox = new QComboBox;
QString setLanguage = settingsCache->getLang(); QString setLanguage = settingsCache->getLang();
QStringList qmFiles = findQmFiles(); QStringList qmFiles = findQmFiles();
for (int i = 0; i < qmFiles.size(); i++) { for (int i = 0; i < qmFiles.size(); i++) {
QString langName = languageName(qmFiles[i]); QString langName = languageName(qmFiles[i]);
languageBox->addItem(langName, qmFiles[i]); languageBox.addItem(langName, qmFiles[i]);
if ((qmFiles[i] == setLanguage) || (setLanguage.isEmpty() && langName == tr("English"))) if ((qmFiles[i] == setLanguage) || (setLanguage.isEmpty() && langName == tr("English")))
languageBox->setCurrentIndex(i); languageBox.setCurrentIndex(i);
} }
<<<<<<< HEAD
picDownloadCheckBox = new QCheckBox; picDownloadCheckBox = new QCheckBox;
picDownloadCheckBox->setChecked(settingsCache->getPicDownload()); picDownloadCheckBox->setChecked(settingsCache->getPicDownload());
@ -58,68 +56,73 @@ GeneralSettingsPage::GeneralSettingsPage()
pixmapCacheEdit->setSingleStep(64); pixmapCacheEdit->setSingleStep(64);
pixmapCacheEdit->setValue(settingsCache->getPixmapCacheSize()); pixmapCacheEdit->setValue(settingsCache->getPixmapCacheSize());
pixmapCacheEdit->setSuffix(" MB"); pixmapCacheEdit->setSuffix(" MB");
=======
pixmapCacheEdit.setMinimum(64);
pixmapCacheEdit.setMaximum(8192);
pixmapCacheEdit.setSingleStep(64);
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
pixmapCacheEdit.setSuffix(" MB");
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
>>>>>>> 0b02c2b... Refactored General Settings Tab
connect(languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int))); connect(&clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
connect(picDownloadCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownload(int))); connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
connect(picDownloadHqCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownloadHq(int))); connect(&picDownloadCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownload(int)));
connect(pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int))); connect(&picDownloadHqCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownloadHq(int)));
connect(&pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int)));
QGridLayout *personalGrid = new QGridLayout; QGridLayout *personalGrid = new QGridLayout;
personalGrid->addWidget(languageLabel, 0, 0); personalGrid->addWidget(&languageLabel, 0, 0);
personalGrid->addWidget(languageBox, 0, 1); personalGrid->addWidget(&languageBox, 0, 1);
personalGrid->addWidget(pixmapCacheLabel, 1, 0, 1, 1); personalGrid->addWidget(&pixmapCacheLabel, 1, 0, 1, 1);
personalGrid->addWidget(pixmapCacheEdit, 1, 1, 1, 1); personalGrid->addWidget(&pixmapCacheEdit, 1, 1, 1, 1);
personalGrid->addWidget(picDownloadCheckBox, 2, 0, 1, 2); personalGrid->addWidget(&picDownloadCheckBox, 2, 0, 1, 2);
personalGrid->addWidget(picDownloadHqCheckBox, 3, 0, 1, 2); personalGrid->addWidget(&picDownloadHqCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(clearDownloadedPicsButton, 4, 0, 1, 1); personalGrid->addWidget(&clearDownloadedPicsButton, 4, 0, 1, 1);
personalGroupBox = new QGroupBox; personalGroupBox = new QGroupBox;
personalGroupBox->setLayout(personalGrid); personalGroupBox->setLayout(personalGrid);
deckPathLabel = new QLabel;
deckPathEdit = new QLineEdit(settingsCache->getDeckPath()); deckPathEdit = new QLineEdit(settingsCache->getDeckPath());
deckPathEdit->setReadOnly(true); deckPathEdit->setReadOnly(true);
QPushButton *deckPathButton = new QPushButton("..."); QPushButton *deckPathButton = new QPushButton("...");
connect(deckPathButton, SIGNAL(clicked()), this, SLOT(deckPathButtonClicked())); connect(deckPathButton, SIGNAL(clicked()), this, SLOT(deckPathButtonClicked()));
replaysPathLabel = new QLabel;
replaysPathEdit = new QLineEdit(settingsCache->getReplaysPath()); replaysPathEdit = new QLineEdit(settingsCache->getReplaysPath());
replaysPathEdit->setReadOnly(true); replaysPathEdit->setReadOnly(true);
QPushButton *replaysPathButton = new QPushButton("..."); QPushButton *replaysPathButton = new QPushButton("...");
connect(replaysPathButton, SIGNAL(clicked()), this, SLOT(replaysPathButtonClicked())); connect(replaysPathButton, SIGNAL(clicked()), this, SLOT(replaysPathButtonClicked()));
picsPathLabel = new QLabel;
picsPathEdit = new QLineEdit(settingsCache->getPicsPath()); picsPathEdit = new QLineEdit(settingsCache->getPicsPath());
picsPathEdit->setReadOnly(true); picsPathEdit->setReadOnly(true);
QPushButton *picsPathButton = new QPushButton("..."); QPushButton *picsPathButton = new QPushButton("...");
connect(picsPathButton, SIGNAL(clicked()), this, SLOT(picsPathButtonClicked())); connect(picsPathButton, SIGNAL(clicked()), this, SLOT(picsPathButtonClicked()));
cardDatabasePathLabel = new QLabel;
cardDatabasePathEdit = new QLineEdit(settingsCache->getCardDatabasePath()); cardDatabasePathEdit = new QLineEdit(settingsCache->getCardDatabasePath());
cardDatabasePathEdit->setReadOnly(true); cardDatabasePathEdit->setReadOnly(true);
QPushButton *cardDatabasePathButton = new QPushButton("..."); QPushButton *cardDatabasePathButton = new QPushButton("...");
connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked())); connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked()));
tokenDatabasePathLabel = new QLabel;
tokenDatabasePathEdit = new QLineEdit(settingsCache->getTokenDatabasePath()); tokenDatabasePathEdit = new QLineEdit(settingsCache->getTokenDatabasePath());
tokenDatabasePathEdit->setReadOnly(true); tokenDatabasePathEdit->setReadOnly(true);
QPushButton *tokenDatabasePathButton = new QPushButton("..."); QPushButton *tokenDatabasePathButton = new QPushButton("...");
connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked())); connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked()));
QGridLayout *pathsGrid = new QGridLayout; QGridLayout *pathsGrid = new QGridLayout;
pathsGrid->addWidget(deckPathLabel, 0, 0); pathsGrid->addWidget(&deckPathLabel, 0, 0);
pathsGrid->addWidget(deckPathEdit, 0, 1); pathsGrid->addWidget(deckPathEdit, 0, 1);
pathsGrid->addWidget(deckPathButton, 0, 2); pathsGrid->addWidget(deckPathButton, 0, 2);
pathsGrid->addWidget(replaysPathLabel, 1, 0); pathsGrid->addWidget(&replaysPathLabel, 1, 0);
pathsGrid->addWidget(replaysPathEdit, 1, 1); pathsGrid->addWidget(replaysPathEdit, 1, 1);
pathsGrid->addWidget(replaysPathButton, 1, 2); pathsGrid->addWidget(replaysPathButton, 1, 2);
pathsGrid->addWidget(picsPathLabel, 2, 0); pathsGrid->addWidget(&picsPathLabel, 2, 0);
pathsGrid->addWidget(picsPathEdit, 2, 1); pathsGrid->addWidget(picsPathEdit, 2, 1);
pathsGrid->addWidget(picsPathButton, 2, 2); pathsGrid->addWidget(picsPathButton, 2, 2);
pathsGrid->addWidget(cardDatabasePathLabel, 3, 0); pathsGrid->addWidget(&cardDatabasePathLabel, 3, 0);
pathsGrid->addWidget(cardDatabasePathEdit, 3, 1); pathsGrid->addWidget(cardDatabasePathEdit, 3, 1);
pathsGrid->addWidget(cardDatabasePathButton, 3, 2); pathsGrid->addWidget(cardDatabasePathButton, 3, 2);
pathsGrid->addWidget(tokenDatabasePathLabel, 4, 0); pathsGrid->addWidget(&tokenDatabasePathLabel, 4, 0);
pathsGrid->addWidget(tokenDatabasePathEdit, 4, 1); pathsGrid->addWidget(tokenDatabasePathEdit, 4, 1);
pathsGrid->addWidget(tokenDatabasePathButton, 4, 2); pathsGrid->addWidget(tokenDatabasePathButton, 4, 2);
pathsGroupBox = new QGroupBox; pathsGroupBox = new QGroupBox;
@ -224,30 +227,29 @@ void GeneralSettingsPage::tokenDatabasePathButtonClicked()
void GeneralSettingsPage::languageBoxChanged(int index) void GeneralSettingsPage::languageBoxChanged(int index)
{ {
settingsCache->setLang(languageBox->itemData(index).toString()); settingsCache->setLang(languageBox.itemData(index).toString());
} }
void GeneralSettingsPage::retranslateUi() void GeneralSettingsPage::retranslateUi()
{ {
personalGroupBox->setTitle(tr("Personal settings")); personalGroupBox->setTitle(tr("Personal settings"));
languageLabel->setText(tr("Language:")); languageLabel.setText(tr("Language:"));
picDownloadCheckBox->setText(tr("Download card pictures on the fly")); picDownloadCheckBox.setText(tr("Download card pictures on the fly"));
picDownloadHqCheckBox->setText(tr("Download high-quality card pictures")); picDownloadHqCheckBox.setText(tr("Download high-quality card pictures"));
pathsGroupBox->setTitle(tr("Paths")); pathsGroupBox->setTitle(tr("Paths"));
deckPathLabel->setText(tr("Decks directory:")); deckPathLabel.setText(tr("Decks directory:"));
replaysPathLabel->setText(tr("Replays directory:")); replaysPathLabel.setText(tr("Replays directory:"));
picsPathLabel->setText(tr("Pictures directory:")); picsPathLabel.setText(tr("Pictures directory:"));
cardDatabasePathLabel->setText(tr("Card database:")); cardDatabasePathLabel.setText(tr("Card database:"));
tokenDatabasePathLabel->setText(tr("Token database:")); tokenDatabasePathLabel.setText(tr("Token database:"));
pixmapCacheLabel->setText(tr("Picture cache size:")); pixmapCacheLabel.setText(tr("Picture cache size:"));
clearDownloadedPicsButton->setText(tr("Reset/Clear Downloaded Pictures")); clearDownloadedPicsButton.setText(tr("Reset/Clear Downloaded Pictures"));
} }
AppearanceSettingsPage::AppearanceSettingsPage() AppearanceSettingsPage::AppearanceSettingsPage()
{ {
QIcon deleteIcon(":/resources/icon_delete.svg"); QIcon deleteIcon(":/resources/icon_delete.svg");
handBgLabel = new QLabel;
handBgEdit = new QLineEdit(settingsCache->getHandBgPath()); handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
handBgEdit->setReadOnly(true); handBgEdit->setReadOnly(true);
QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString()); QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString());
@ -255,7 +257,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *handBgButton = new QPushButton("..."); QPushButton *handBgButton = new QPushButton("...");
connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked())); connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));
stackBgLabel = new QLabel;
stackBgEdit = new QLineEdit(settingsCache->getStackBgPath()); stackBgEdit = new QLineEdit(settingsCache->getStackBgPath());
stackBgEdit->setReadOnly(true); stackBgEdit->setReadOnly(true);
QPushButton *stackBgClearButton = new QPushButton(deleteIcon, QString()); QPushButton *stackBgClearButton = new QPushButton(deleteIcon, QString());
@ -263,7 +264,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *stackBgButton = new QPushButton("..."); QPushButton *stackBgButton = new QPushButton("...");
connect(stackBgButton, SIGNAL(clicked()), this, SLOT(stackBgButtonClicked())); connect(stackBgButton, SIGNAL(clicked()), this, SLOT(stackBgButtonClicked()));
tableBgLabel = new QLabel;
tableBgEdit = new QLineEdit(settingsCache->getTableBgPath()); tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
tableBgEdit->setReadOnly(true); tableBgEdit->setReadOnly(true);
QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString()); QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString());
@ -271,7 +271,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *tableBgButton = new QPushButton("..."); QPushButton *tableBgButton = new QPushButton("...");
connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked())); connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));
playerAreaBgLabel = new QLabel;
playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath()); playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
playerAreaBgEdit->setReadOnly(true); playerAreaBgEdit->setReadOnly(true);
QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString()); QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString());
@ -279,7 +278,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *playerAreaBgButton = new QPushButton("..."); QPushButton *playerAreaBgButton = new QPushButton("...");
connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked())); connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));
cardBackPicturePathLabel = new QLabel;
cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath()); cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath());
cardBackPicturePathEdit->setReadOnly(true); cardBackPicturePathEdit->setReadOnly(true);
QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString()); QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString());
@ -288,23 +286,23 @@ AppearanceSettingsPage::AppearanceSettingsPage()
connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked())); connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked()));
QGridLayout *zoneBgGrid = new QGridLayout; QGridLayout *zoneBgGrid = new QGridLayout;
zoneBgGrid->addWidget(handBgLabel, 0, 0); zoneBgGrid->addWidget(&handBgLabel, 0, 0);
zoneBgGrid->addWidget(handBgEdit, 0, 1); zoneBgGrid->addWidget(handBgEdit, 0, 1);
zoneBgGrid->addWidget(handBgClearButton, 0, 2); zoneBgGrid->addWidget(handBgClearButton, 0, 2);
zoneBgGrid->addWidget(handBgButton, 0, 3); zoneBgGrid->addWidget(handBgButton, 0, 3);
zoneBgGrid->addWidget(stackBgLabel, 1, 0); zoneBgGrid->addWidget(&stackBgLabel, 1, 0);
zoneBgGrid->addWidget(stackBgEdit, 1, 1); zoneBgGrid->addWidget(stackBgEdit, 1, 1);
zoneBgGrid->addWidget(stackBgClearButton, 1, 2); zoneBgGrid->addWidget(stackBgClearButton, 1, 2);
zoneBgGrid->addWidget(stackBgButton, 1, 3); zoneBgGrid->addWidget(stackBgButton, 1, 3);
zoneBgGrid->addWidget(tableBgLabel, 2, 0); zoneBgGrid->addWidget(&tableBgLabel, 2, 0);
zoneBgGrid->addWidget(tableBgEdit, 2, 1); zoneBgGrid->addWidget(tableBgEdit, 2, 1);
zoneBgGrid->addWidget(tableBgClearButton, 2, 2); zoneBgGrid->addWidget(tableBgClearButton, 2, 2);
zoneBgGrid->addWidget(tableBgButton, 2, 3); zoneBgGrid->addWidget(tableBgButton, 2, 3);
zoneBgGrid->addWidget(playerAreaBgLabel, 3, 0); zoneBgGrid->addWidget(&playerAreaBgLabel, 3, 0);
zoneBgGrid->addWidget(playerAreaBgEdit, 3, 1); zoneBgGrid->addWidget(playerAreaBgEdit, 3, 1);
zoneBgGrid->addWidget(playerAreaBgClearButton, 3, 2); zoneBgGrid->addWidget(playerAreaBgClearButton, 3, 2);
zoneBgGrid->addWidget(playerAreaBgButton, 3, 3); zoneBgGrid->addWidget(playerAreaBgButton, 3, 3);
zoneBgGrid->addWidget(cardBackPicturePathLabel, 4, 0); zoneBgGrid->addWidget(&cardBackPicturePathLabel, 4, 0);
zoneBgGrid->addWidget(cardBackPicturePathEdit, 4, 1); zoneBgGrid->addWidget(cardBackPicturePathEdit, 4, 1);
zoneBgGrid->addWidget(cardBackPicturePathClearButton, 4, 2); zoneBgGrid->addWidget(cardBackPicturePathClearButton, 4, 2);
zoneBgGrid->addWidget(cardBackPicturePathButton, 4, 3); zoneBgGrid->addWidget(cardBackPicturePathButton, 4, 3);
@ -312,65 +310,45 @@ AppearanceSettingsPage::AppearanceSettingsPage()
zoneBgGroupBox = new QGroupBox; zoneBgGroupBox = new QGroupBox;
zoneBgGroupBox->setLayout(zoneBgGrid); zoneBgGroupBox->setLayout(zoneBgGrid);
displayCardNamesCheckBox = new QCheckBox; displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
displayCardNamesCheckBox->setChecked(settingsCache->getDisplayCardNames()); connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
connect(displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
QGridLayout *cardsGrid = new QGridLayout; QGridLayout *cardsGrid = new QGridLayout;
cardsGrid->addWidget(displayCardNamesCheckBox, 0, 0, 1, 2); cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
cardsGroupBox = new QGroupBox; cardsGroupBox = new QGroupBox;
cardsGroupBox->setLayout(cardsGrid); cardsGroupBox->setLayout(cardsGrid);
horizontalHandCheckBox = new QCheckBox; horizontalHandCheckBox.setChecked(settingsCache->getHorizontalHand());
horizontalHandCheckBox->setChecked(settingsCache->getHorizontalHand()); connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));
connect(horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));
QGridLayout *handGrid = new QGridLayout; QGridLayout *handGrid = new QGridLayout;
handGrid->addWidget(horizontalHandCheckBox, 0, 0, 1, 2); handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
handGroupBox = new QGroupBox; handGroupBox = new QGroupBox;
handGroupBox->setLayout(handGrid); handGroupBox->setLayout(handGrid);
invertVerticalCoordinateCheckBox = new QCheckBox; invertVerticalCoordinateCheckBox.setChecked(settingsCache->getInvertVerticalCoordinate());
invertVerticalCoordinateCheckBox->setChecked(settingsCache->getInvertVerticalCoordinate()); connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));
connect(invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));
minPlayersForMultiColumnLayoutLabel = new QLabel; minPlayersForMultiColumnLayoutEdit.setMinimum(2);
minPlayersForMultiColumnLayoutEdit = new QSpinBox; minPlayersForMultiColumnLayoutEdit.setValue(settingsCache->getMinPlayersForMultiColumnLayout());
minPlayersForMultiColumnLayoutEdit->setMinimum(2); connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
minPlayersForMultiColumnLayoutEdit->setValue(settingsCache->getMinPlayersForMultiColumnLayout()); minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
connect(minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
minPlayersForMultiColumnLayoutLabel->setBuddy(minPlayersForMultiColumnLayoutEdit);
QGridLayout *tableGrid = new QGridLayout; QGridLayout *tableGrid = new QGridLayout;
tableGrid->addWidget(invertVerticalCoordinateCheckBox, 0, 0, 1, 2); tableGrid->addWidget(&invertVerticalCoordinateCheckBox, 0, 0, 1, 2);
tableGrid->addWidget(minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1); tableGrid->addWidget(&minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1);
tableGrid->addWidget(minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1); tableGrid->addWidget(&minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1);
tableGroupBox = new QGroupBox; tableGroupBox = new QGroupBox;
tableGroupBox->setLayout(tableGrid); tableGroupBox->setLayout(tableGrid);
zoneViewSortByNameCheckBox = new QCheckBox;
zoneViewSortByNameCheckBox->setChecked(settingsCache->getZoneViewSortByName());
connect(zoneViewSortByNameCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setZoneViewSortByName(int)));
zoneViewSortByTypeCheckBox = new QCheckBox;
zoneViewSortByTypeCheckBox->setChecked(settingsCache->getZoneViewSortByType());
connect(zoneViewSortByTypeCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setZoneViewSortByType(int)));
QGridLayout *zoneViewGrid = new QGridLayout;
zoneViewGrid->addWidget(zoneViewSortByNameCheckBox, 0, 0, 1, 2);
zoneViewGrid->addWidget(zoneViewSortByTypeCheckBox, 1, 0, 1, 2);
zoneViewGroupBox = new QGroupBox;
zoneViewGroupBox->setLayout(zoneViewGrid);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(zoneBgGroupBox); mainLayout->addWidget(zoneBgGroupBox);
mainLayout->addWidget(cardsGroupBox); mainLayout->addWidget(cardsGroupBox);
mainLayout->addWidget(handGroupBox); mainLayout->addWidget(handGroupBox);
mainLayout->addWidget(tableGroupBox); mainLayout->addWidget(tableGroupBox);
mainLayout->addWidget(zoneViewGroupBox);
setLayout(mainLayout); setLayout(mainLayout);
} }
@ -378,25 +356,21 @@ AppearanceSettingsPage::AppearanceSettingsPage()
void AppearanceSettingsPage::retranslateUi() void AppearanceSettingsPage::retranslateUi()
{ {
zoneBgGroupBox->setTitle(tr("Zone background pictures")); zoneBgGroupBox->setTitle(tr("Zone background pictures"));
handBgLabel->setText(tr("Hand background:")); handBgLabel.setText(tr("Hand background:"));
stackBgLabel->setText(tr("Stack background:")); stackBgLabel.setText(tr("Stack background:"));
tableBgLabel->setText(tr("Table background:")); tableBgLabel.setText(tr("Table background:"));
playerAreaBgLabel->setText(tr("Player info background:")); playerAreaBgLabel.setText(tr("Player info background:"));
cardBackPicturePathLabel->setText(tr("Card back:")); cardBackPicturePathLabel.setText(tr("Card back:"));
cardsGroupBox->setTitle(tr("Card rendering")); cardsGroupBox->setTitle(tr("Card rendering"));
displayCardNamesCheckBox->setText(tr("Display card names on cards having a picture")); displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
handGroupBox->setTitle(tr("Hand layout")); handGroupBox->setTitle(tr("Hand layout"));
horizontalHandCheckBox->setText(tr("Display hand horizontally (wastes space)")); horizontalHandCheckBox.setText(tr("Display hand horizontally (wastes space)"));
tableGroupBox->setTitle(tr("Table grid layout")); tableGroupBox->setTitle(tr("Table grid layout"));
invertVerticalCoordinateCheckBox->setText(tr("Invert vertical coordinate")); invertVerticalCoordinateCheckBox.setText(tr("Invert vertical coordinate"));
minPlayersForMultiColumnLayoutLabel->setText(tr("Minimum player count for multi-column layout:")); minPlayersForMultiColumnLayoutLabel.setText(tr("Minimum player count for multi-column layout:"));
zoneViewGroupBox->setTitle(tr("Zone view layout"));
zoneViewSortByNameCheckBox->setText(tr("Sort by name"));
zoneViewSortByTypeCheckBox->setText(tr("Sort by type"));
} }
void AppearanceSettingsPage::handBgClearButtonClicked() void AppearanceSettingsPage::handBgClearButtonClicked()

View file

@ -1,7 +1,13 @@
#ifndef DLG_SETTINGS_H #ifndef DLG_SETTINGS_H
#define DLG_SETTINGS_H #define DLG_SETTINGS_H
#include <QComboBox>
#include <QCheckBox>
#include <QDialog> #include <QDialog>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
class CardDatabase; class CardDatabase;
class QListWidget; class QListWidget;
@ -39,14 +45,25 @@ private slots:
private: private:
QStringList findQmFiles(); QStringList findQmFiles();
QString languageName(const QString &qmFile); QString languageName(const QString &qmFile);
QLineEdit *deckPathEdit, *replaysPathEdit, *picsPathEdit, *cardDatabasePathEdit, *tokenDatabasePathEdit; QLineEdit *deckPathEdit;
QSpinBox *pixmapCacheEdit; QLineEdit *replaysPathEdit;
QGroupBox *personalGroupBox, *pathsGroupBox; QLineEdit *picsPathEdit;
QComboBox *languageBox; QLineEdit *cardDatabasePathEdit;
QCheckBox *picDownloadCheckBox; QLineEdit *tokenDatabasePathEdit;
QCheckBox *picDownloadHqCheckBox; QSpinBox pixmapCacheEdit;
QLabel *languageLabel, *deckPathLabel, *replaysPathLabel, *picsPathLabel, *cardDatabasePathLabel, *tokenDatabasePathLabel, *pixmapCacheLabel; QGroupBox *personalGroupBox;
QPushButton *clearDownloadedPicsButton; QGroupBox *pathsGroupBox;
QComboBox languageBox;
QCheckBox picDownloadCheckBox;
QCheckBox picDownloadHqCheckBox;
QLabel languageLabel;
QLabel pixmapCacheLabel;
QLabel deckPathLabel;
QLabel replaysPathLabel;
QLabel picsPathLabel;
QLabel cardDatabasePathLabel;
QLabel tokenDatabasePathLabel;
QPushButton clearDownloadedPicsButton;
}; };
class AppearanceSettingsPage : public AbstractSettingsPage { class AppearanceSettingsPage : public AbstractSettingsPage {
@ -69,11 +86,25 @@ signals:
void playerAreaBgChanged(const QString &path); void playerAreaBgChanged(const QString &path);
void cardBackPicturePathChanged(const QString &path); void cardBackPicturePathChanged(const QString &path);
private: private:
QLabel *handBgLabel, *stackBgLabel, *tableBgLabel, *playerAreaBgLabel, *cardBackPicturePathLabel, *minPlayersForMultiColumnLayoutLabel; QLabel handBgLabel;
QLineEdit *handBgEdit, *stackBgEdit, *tableBgEdit, *playerAreaBgEdit, *cardBackPicturePathEdit; QLabel stackBgLabel;
QCheckBox *displayCardNamesCheckBox, *horizontalHandCheckBox, *invertVerticalCoordinateCheckBox, *zoneViewSortByNameCheckBox, *zoneViewSortByTypeCheckBox; QLabel tableBgLabel;
QGroupBox *zoneBgGroupBox, *cardsGroupBox, *handGroupBox, *tableGroupBox, *zoneViewGroupBox; QLabel playerAreaBgLabel;
QSpinBox *minPlayersForMultiColumnLayoutEdit; QLabel cardBackPicturePathLabel;
QLabel minPlayersForMultiColumnLayoutLabel;
QLineEdit *handBgEdit;
QLineEdit *stackBgEdit;
QLineEdit *tableBgEdit;
QLineEdit *playerAreaBgEdit;
QLineEdit *cardBackPicturePathEdit;
QCheckBox displayCardNamesCheckBox;
QCheckBox horizontalHandCheckBox;
QCheckBox invertVerticalCoordinateCheckBox;
QGroupBox *zoneBgGroupBox;
QGroupBox *cardsGroupBox;
QGroupBox *handGroupBox;
QGroupBox *tableGroupBox;
QSpinBox minPlayersForMultiColumnLayoutEdit;
public: public:
AppearanceSettingsPage(); AppearanceSettingsPage();
void retranslateUi(); void retranslateUi();