Merge pull request #556 from poixen/settings_dlg_refactorings

Refactored Settings Tab
This commit is contained in:
Gavin Bisesi 2015-01-20 11:39:25 -05:00
commit 931b420323
2 changed files with 166 additions and 178 deletions

View file

@ -29,97 +29,92 @@
GeneralSettingsPage::GeneralSettingsPage()
{
languageLabel = new QLabel;
languageBox = new QComboBox;
QString setLanguage = settingsCache->getLang();
QStringList qmFiles = findQmFiles();
for (int i = 0; i < qmFiles.size(); 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")))
languageBox->setCurrentIndex(i);
languageBox.setCurrentIndex(i);
}
picDownloadCheckBox = new QCheckBox;
picDownloadCheckBox->setChecked(settingsCache->getPicDownload());
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
clearDownloadedPicsButton = new QPushButton();
connect(clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
connect(&clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
picDownloadHqCheckBox = new QCheckBox;
picDownloadHqCheckBox->setChecked(settingsCache->getPicDownloadHq());
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
pixmapCacheLabel = new QLabel;
pixmapCacheEdit = new QSpinBox;
pixmapCacheEdit->setMinimum(PIXMAPCACHE_SIZE_MIN);
pixmapCacheEdit.setMinimum(PIXMAPCACHE_SIZE_MIN);
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
pixmapCacheEdit->setMaximum(PIXMAPCACHE_SIZE_MAX);
pixmapCacheEdit->setSingleStep(64);
pixmapCacheEdit->setValue(settingsCache->getPixmapCacheSize());
pixmapCacheEdit->setSuffix(" MB");
pixmapCacheEdit.setMaximum(PIXMAPCACHE_SIZE_MAX);
pixmapCacheEdit.setSingleStep(64);
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
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());
connect(languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
connect(picDownloadCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownload(int)));
connect(picDownloadHqCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownloadHq(int)));
connect(pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int)));
connect(&clearDownloadedPicsButton, SIGNAL(clicked()), this, SLOT(clearDownloadedPicsButtonClicked()));
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
connect(&picDownloadCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownload(int)));
connect(&picDownloadHqCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPicDownloadHq(int)));
connect(&pixmapCacheEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setPixmapCacheSize(int)));
QGridLayout *personalGrid = new QGridLayout;
personalGrid->addWidget(languageLabel, 0, 0);
personalGrid->addWidget(languageBox, 0, 1);
personalGrid->addWidget(pixmapCacheLabel, 1, 0, 1, 1);
personalGrid->addWidget(pixmapCacheEdit, 1, 1, 1, 1);
personalGrid->addWidget(picDownloadCheckBox, 2, 0, 1, 2);
personalGrid->addWidget(picDownloadHqCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(clearDownloadedPicsButton, 4, 0, 1, 1);
personalGrid->addWidget(&languageLabel, 0, 0);
personalGrid->addWidget(&languageBox, 0, 1);
personalGrid->addWidget(&pixmapCacheLabel, 1, 0, 1, 1);
personalGrid->addWidget(&pixmapCacheEdit, 1, 1, 1, 1);
personalGrid->addWidget(&picDownloadCheckBox, 2, 0, 1, 2);
personalGrid->addWidget(&picDownloadHqCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(&clearDownloadedPicsButton, 4, 0, 1, 1);
personalGroupBox = new QGroupBox;
personalGroupBox->setLayout(personalGrid);
deckPathLabel = new QLabel;
deckPathEdit = new QLineEdit(settingsCache->getDeckPath());
deckPathEdit->setReadOnly(true);
QPushButton *deckPathButton = new QPushButton("...");
connect(deckPathButton, SIGNAL(clicked()), this, SLOT(deckPathButtonClicked()));
replaysPathLabel = new QLabel;
replaysPathEdit = new QLineEdit(settingsCache->getReplaysPath());
replaysPathEdit->setReadOnly(true);
QPushButton *replaysPathButton = new QPushButton("...");
connect(replaysPathButton, SIGNAL(clicked()), this, SLOT(replaysPathButtonClicked()));
picsPathLabel = new QLabel;
picsPathEdit = new QLineEdit(settingsCache->getPicsPath());
picsPathEdit->setReadOnly(true);
QPushButton *picsPathButton = new QPushButton("...");
connect(picsPathButton, SIGNAL(clicked()), this, SLOT(picsPathButtonClicked()));
cardDatabasePathLabel = new QLabel;
cardDatabasePathEdit = new QLineEdit(settingsCache->getCardDatabasePath());
cardDatabasePathEdit->setReadOnly(true);
QPushButton *cardDatabasePathButton = new QPushButton("...");
connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked()));
tokenDatabasePathLabel = new QLabel;
tokenDatabasePathEdit = new QLineEdit(settingsCache->getTokenDatabasePath());
tokenDatabasePathEdit->setReadOnly(true);
QPushButton *tokenDatabasePathButton = new QPushButton("...");
connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked()));
QGridLayout *pathsGrid = new QGridLayout;
pathsGrid->addWidget(deckPathLabel, 0, 0);
pathsGrid->addWidget(&deckPathLabel, 0, 0);
pathsGrid->addWidget(deckPathEdit, 0, 1);
pathsGrid->addWidget(deckPathButton, 0, 2);
pathsGrid->addWidget(replaysPathLabel, 1, 0);
pathsGrid->addWidget(&replaysPathLabel, 1, 0);
pathsGrid->addWidget(replaysPathEdit, 1, 1);
pathsGrid->addWidget(replaysPathButton, 1, 2);
pathsGrid->addWidget(picsPathLabel, 2, 0);
pathsGrid->addWidget(&picsPathLabel, 2, 0);
pathsGrid->addWidget(picsPathEdit, 2, 1);
pathsGrid->addWidget(picsPathButton, 2, 2);
pathsGrid->addWidget(cardDatabasePathLabel, 3, 0);
pathsGrid->addWidget(&cardDatabasePathLabel, 3, 0);
pathsGrid->addWidget(cardDatabasePathEdit, 3, 1);
pathsGrid->addWidget(cardDatabasePathButton, 3, 2);
pathsGrid->addWidget(tokenDatabasePathLabel, 4, 0);
pathsGrid->addWidget(&tokenDatabasePathLabel, 4, 0);
pathsGrid->addWidget(tokenDatabasePathEdit, 4, 1);
pathsGrid->addWidget(tokenDatabasePathButton, 4, 2);
pathsGroupBox = new QGroupBox;
@ -224,30 +219,29 @@ void GeneralSettingsPage::tokenDatabasePathButtonClicked()
void GeneralSettingsPage::languageBoxChanged(int index)
{
settingsCache->setLang(languageBox->itemData(index).toString());
settingsCache->setLang(languageBox.itemData(index).toString());
}
void GeneralSettingsPage::retranslateUi()
{
personalGroupBox->setTitle(tr("Personal settings"));
languageLabel->setText(tr("Language:"));
picDownloadCheckBox->setText(tr("Download card pictures on the fly"));
picDownloadHqCheckBox->setText(tr("Download high-quality card pictures"));
languageLabel.setText(tr("Language:"));
picDownloadCheckBox.setText(tr("Download card pictures on the fly"));
picDownloadHqCheckBox.setText(tr("Download high-quality card pictures"));
pathsGroupBox->setTitle(tr("Paths"));
deckPathLabel->setText(tr("Decks directory:"));
replaysPathLabel->setText(tr("Replays directory:"));
picsPathLabel->setText(tr("Pictures directory:"));
cardDatabasePathLabel->setText(tr("Card database:"));
tokenDatabasePathLabel->setText(tr("Token database:"));
pixmapCacheLabel->setText(tr("Picture cache size:"));
clearDownloadedPicsButton->setText(tr("Reset/Clear Downloaded Pictures"));
deckPathLabel.setText(tr("Decks directory:"));
replaysPathLabel.setText(tr("Replays directory:"));
picsPathLabel.setText(tr("Pictures directory:"));
cardDatabasePathLabel.setText(tr("Card database:"));
tokenDatabasePathLabel.setText(tr("Token database:"));
pixmapCacheLabel.setText(tr("Picture cache size:"));
clearDownloadedPicsButton.setText(tr("Reset/Clear Downloaded Pictures"));
}
AppearanceSettingsPage::AppearanceSettingsPage()
{
QIcon deleteIcon(":/resources/icon_delete.svg");
handBgLabel = new QLabel;
handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
handBgEdit->setReadOnly(true);
QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString());
@ -255,7 +249,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *handBgButton = new QPushButton("...");
connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));
stackBgLabel = new QLabel;
stackBgEdit = new QLineEdit(settingsCache->getStackBgPath());
stackBgEdit->setReadOnly(true);
QPushButton *stackBgClearButton = new QPushButton(deleteIcon, QString());
@ -263,7 +256,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *stackBgButton = new QPushButton("...");
connect(stackBgButton, SIGNAL(clicked()), this, SLOT(stackBgButtonClicked()));
tableBgLabel = new QLabel;
tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
tableBgEdit->setReadOnly(true);
QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString());
@ -271,7 +263,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *tableBgButton = new QPushButton("...");
connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));
playerAreaBgLabel = new QLabel;
playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
playerAreaBgEdit->setReadOnly(true);
QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString());
@ -279,7 +270,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
QPushButton *playerAreaBgButton = new QPushButton("...");
connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));
cardBackPicturePathLabel = new QLabel;
cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath());
cardBackPicturePathEdit->setReadOnly(true);
QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString());
@ -288,23 +278,23 @@ AppearanceSettingsPage::AppearanceSettingsPage()
connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked()));
QGridLayout *zoneBgGrid = new QGridLayout;
zoneBgGrid->addWidget(handBgLabel, 0, 0);
zoneBgGrid->addWidget(&handBgLabel, 0, 0);
zoneBgGrid->addWidget(handBgEdit, 0, 1);
zoneBgGrid->addWidget(handBgClearButton, 0, 2);
zoneBgGrid->addWidget(handBgButton, 0, 3);
zoneBgGrid->addWidget(stackBgLabel, 1, 0);
zoneBgGrid->addWidget(&stackBgLabel, 1, 0);
zoneBgGrid->addWidget(stackBgEdit, 1, 1);
zoneBgGrid->addWidget(stackBgClearButton, 1, 2);
zoneBgGrid->addWidget(stackBgButton, 1, 3);
zoneBgGrid->addWidget(tableBgLabel, 2, 0);
zoneBgGrid->addWidget(&tableBgLabel, 2, 0);
zoneBgGrid->addWidget(tableBgEdit, 2, 1);
zoneBgGrid->addWidget(tableBgClearButton, 2, 2);
zoneBgGrid->addWidget(tableBgButton, 2, 3);
zoneBgGrid->addWidget(playerAreaBgLabel, 3, 0);
zoneBgGrid->addWidget(&playerAreaBgLabel, 3, 0);
zoneBgGrid->addWidget(playerAreaBgEdit, 3, 1);
zoneBgGrid->addWidget(playerAreaBgClearButton, 3, 2);
zoneBgGrid->addWidget(playerAreaBgButton, 3, 3);
zoneBgGrid->addWidget(cardBackPicturePathLabel, 4, 0);
zoneBgGrid->addWidget(&cardBackPicturePathLabel, 4, 0);
zoneBgGrid->addWidget(cardBackPicturePathEdit, 4, 1);
zoneBgGrid->addWidget(cardBackPicturePathClearButton, 4, 2);
zoneBgGrid->addWidget(cardBackPicturePathButton, 4, 3);
@ -312,65 +302,45 @@ AppearanceSettingsPage::AppearanceSettingsPage()
zoneBgGroupBox = new QGroupBox;
zoneBgGroupBox->setLayout(zoneBgGrid);
displayCardNamesCheckBox = new QCheckBox;
displayCardNamesCheckBox->setChecked(settingsCache->getDisplayCardNames());
connect(displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));
QGridLayout *cardsGrid = new QGridLayout;
cardsGrid->addWidget(displayCardNamesCheckBox, 0, 0, 1, 2);
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
cardsGroupBox = new QGroupBox;
cardsGroupBox->setLayout(cardsGrid);
horizontalHandCheckBox = new QCheckBox;
horizontalHandCheckBox->setChecked(settingsCache->getHorizontalHand());
connect(horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));
horizontalHandCheckBox.setChecked(settingsCache->getHorizontalHand());
connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));
QGridLayout *handGrid = new QGridLayout;
handGrid->addWidget(horizontalHandCheckBox, 0, 0, 1, 2);
handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
handGroupBox = new QGroupBox;
handGroupBox->setLayout(handGrid);
invertVerticalCoordinateCheckBox = new QCheckBox;
invertVerticalCoordinateCheckBox->setChecked(settingsCache->getInvertVerticalCoordinate());
connect(invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));
invertVerticalCoordinateCheckBox.setChecked(settingsCache->getInvertVerticalCoordinate());
connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));
minPlayersForMultiColumnLayoutLabel = new QLabel;
minPlayersForMultiColumnLayoutEdit = new QSpinBox;
minPlayersForMultiColumnLayoutEdit->setMinimum(2);
minPlayersForMultiColumnLayoutEdit->setValue(settingsCache->getMinPlayersForMultiColumnLayout());
connect(minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
minPlayersForMultiColumnLayoutLabel->setBuddy(minPlayersForMultiColumnLayoutEdit);
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
minPlayersForMultiColumnLayoutEdit.setValue(settingsCache->getMinPlayersForMultiColumnLayout());
connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
QGridLayout *tableGrid = new QGridLayout;
tableGrid->addWidget(invertVerticalCoordinateCheckBox, 0, 0, 1, 2);
tableGrid->addWidget(minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1);
tableGrid->addWidget(minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1);
tableGrid->addWidget(&invertVerticalCoordinateCheckBox, 0, 0, 1, 2);
tableGrid->addWidget(&minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1);
tableGrid->addWidget(&minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1);
tableGroupBox = new QGroupBox;
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;
mainLayout->addWidget(zoneBgGroupBox);
mainLayout->addWidget(cardsGroupBox);
mainLayout->addWidget(handGroupBox);
mainLayout->addWidget(tableGroupBox);
mainLayout->addWidget(zoneViewGroupBox);
setLayout(mainLayout);
}
@ -378,25 +348,21 @@ AppearanceSettingsPage::AppearanceSettingsPage()
void AppearanceSettingsPage::retranslateUi()
{
zoneBgGroupBox->setTitle(tr("Zone background pictures"));
handBgLabel->setText(tr("Hand background:"));
stackBgLabel->setText(tr("Stack background:"));
tableBgLabel->setText(tr("Table background:"));
playerAreaBgLabel->setText(tr("Player info background:"));
cardBackPicturePathLabel->setText(tr("Card back:"));
handBgLabel.setText(tr("Hand background:"));
stackBgLabel.setText(tr("Stack background:"));
tableBgLabel.setText(tr("Table background:"));
playerAreaBgLabel.setText(tr("Player info background:"));
cardBackPicturePathLabel.setText(tr("Card back:"));
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"));
horizontalHandCheckBox->setText(tr("Display hand horizontally (wastes space)"));
horizontalHandCheckBox.setText(tr("Display hand horizontally (wastes space)"));
tableGroupBox->setTitle(tr("Table grid layout"));
invertVerticalCoordinateCheckBox->setText(tr("Invert vertical coordinate"));
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"));
invertVerticalCoordinateCheckBox.setText(tr("Invert vertical coordinate"));
minPlayersForMultiColumnLayoutLabel.setText(tr("Minimum player count for multi-column layout:"));
}
void AppearanceSettingsPage::handBgClearButtonClicked()
@ -483,63 +449,54 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
{
QIcon deleteIcon(":/resources/icon_delete.svg");
notificationsEnabledCheckBox = new QCheckBox;
notificationsEnabledCheckBox->setChecked(settingsCache->getNotificationsEnabled());
connect(notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
notificationsEnabledCheckBox.setChecked(settingsCache->getNotificationsEnabled());
connect(&notificationsEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setNotificationsEnabled(int)));
doubleClickToPlayCheckBox = new QCheckBox;
doubleClickToPlayCheckBox->setChecked(settingsCache->getDoubleClickToPlay());
connect(doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
doubleClickToPlayCheckBox.setChecked(settingsCache->getDoubleClickToPlay());
connect(&doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
playToStackCheckBox = new QCheckBox;
playToStackCheckBox->setChecked(settingsCache->getPlayToStack());
connect(playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
playToStackCheckBox.setChecked(settingsCache->getPlayToStack());
connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(notificationsEnabledCheckBox, 0, 0);
generalGrid->addWidget(doubleClickToPlayCheckBox, 1, 0);
generalGrid->addWidget(playToStackCheckBox, 2, 0);
generalGrid->addWidget(&notificationsEnabledCheckBox, 0, 0);
generalGrid->addWidget(&doubleClickToPlayCheckBox, 1, 0);
generalGrid->addWidget(&playToStackCheckBox, 2, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
tapAnimationCheckBox = new QCheckBox;
tapAnimationCheckBox->setChecked(settingsCache->getTapAnimation());
connect(tapAnimationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setTapAnimation(int)));
tapAnimationCheckBox.setChecked(settingsCache->getTapAnimation());
connect(&tapAnimationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setTapAnimation(int)));
soundEnabledCheckBox = new QCheckBox;
soundEnabledCheckBox->setChecked(settingsCache->getSoundEnabled());
connect(soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
soundEnabledCheckBox.setChecked(settingsCache->getSoundEnabled());
connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setSoundEnabled(int)));
soundPathLabel = new QLabel;
soundPathEdit = new QLineEdit(settingsCache->getSoundPath());
soundPathEdit->setReadOnly(true);
QPushButton *soundPathClearButton = new QPushButton(deleteIcon, QString());
connect(soundPathClearButton, SIGNAL(clicked()), this, SLOT(soundPathClearButtonClicked()));
QPushButton *soundPathButton = new QPushButton("...");
connect(soundPathButton, SIGNAL(clicked()), this, SLOT(soundPathButtonClicked()));
soundTestButton = new QPushButton();
connect(soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(cuckoo()));
connect(&soundTestButton, SIGNAL(clicked()), soundEngine, SLOT(cuckoo()));
QGridLayout *soundGrid = new QGridLayout;
soundGrid->addWidget(soundEnabledCheckBox, 0, 0, 1, 4);
soundGrid->addWidget(soundPathLabel, 1, 0);
soundGrid->addWidget(&soundEnabledCheckBox, 0, 0, 1, 4);
soundGrid->addWidget(&soundPathLabel, 1, 0);
soundGrid->addWidget(soundPathEdit, 1, 1);
soundGrid->addWidget(soundPathClearButton, 1, 2);
soundGrid->addWidget(soundPathButton, 1, 3);
soundGrid->addWidget(soundTestButton, 2, 1);
soundGrid->addWidget(&soundTestButton, 2, 1);
soundGroupBox = new QGroupBox;
soundGroupBox->setLayout(soundGrid);
QGridLayout *animationGrid = new QGridLayout;
animationGrid->addWidget(tapAnimationCheckBox, 0, 0);
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
animationGroupBox = new QGroupBox;
animationGroupBox->setLayout(animationGrid);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(generalGroupBox);
mainLayout->addWidget(animationGroupBox);
@ -551,14 +508,14 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
void UserInterfaceSettingsPage::retranslateUi()
{
generalGroupBox->setTitle(tr("General interface settings"));
notificationsEnabledCheckBox->setText(tr("Enable notifications in taskbar"));
doubleClickToPlayCheckBox->setText(tr("&Double-click cards to play them (instead of single-click)"));
playToStackCheckBox->setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
notificationsEnabledCheckBox.setText(tr("Enable notifications in taskbar"));
doubleClickToPlayCheckBox.setText(tr("&Double-click cards to play them (instead of single-click)"));
playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
animationGroupBox->setTitle(tr("Animation settings"));
tapAnimationCheckBox->setText(tr("&Tap/untap animation"));
soundEnabledCheckBox->setText(tr("Enable &sounds"));
soundPathLabel->setText(tr("Path to sounds directory:"));
soundTestButton->setText(tr("Test system sound engine"));
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
soundEnabledCheckBox.setText(tr("Enable &sounds"));
soundPathLabel.setText(tr("Path to sounds directory:"));
soundTestButton.setText(tr("Test system sound engine"));
soundGroupBox->setTitle(tr("Sound settings"));
}
@ -580,14 +537,13 @@ void UserInterfaceSettingsPage::soundPathButtonClicked()
DeckEditorSettingsPage::DeckEditorSettingsPage()
{
priceTagsCheckBox = new QCheckBox;
priceTagsCheckBox->setChecked(settingsCache->getPriceTagFeature());
connect(priceTagsCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPriceTagFeature(int)));
priceTagsCheckBox.setChecked(settingsCache->getPriceTagFeature());
connect(&priceTagsCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPriceTagFeature(int)));
connect(this, SIGNAL(priceTagSourceChanged(int)), settingsCache, SLOT(setPriceTagSource(int)));
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(priceTagsCheckBox, 0, 0);
generalGrid->addWidget(&priceTagsCheckBox, 0, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
@ -600,7 +556,7 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
void DeckEditorSettingsPage::retranslateUi()
{
priceTagsCheckBox->setText(tr("Enable &price tag feature from deckbrew.com"));
priceTagsCheckBox.setText(tr("Enable &price tag feature from deckbrew.com"));
generalGroupBox->setTitle(tr("General"));
}
@ -616,11 +572,10 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
MessagesSettingsPage::MessagesSettingsPage()
{
chatMentionCheckBox = new QCheckBox;
chatMentionCheckBox->setChecked(settingsCache->getChatMention());
connect(chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
chatMentionCheckBox.setChecked(settingsCache->getChatMention());
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
QGridLayout *chatGrid = new QGridLayout;
chatGrid->addWidget(chatMentionCheckBox, 0, 0);
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
chatGroupBox = new QGroupBox;
chatGroupBox->setLayout(chatGrid);
@ -690,7 +645,7 @@ void MessagesSettingsPage::retranslateUi()
aAdd->setText(tr("&Add"));
aRemove->setText(tr("&Remove"));
chatGroupBox->setTitle(tr("Chat settings"));
chatMentionCheckBox->setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
messageShortcuts->setTitle(tr("In-game message macros"));
}
@ -732,7 +687,7 @@ DlgSettings::DlgSettings(QWidget *parent)
retranslateUi();
resize(800, 450);
adjustSize();
}
void DlgSettings::createIcons()

View file

@ -1,7 +1,13 @@
#ifndef DLG_SETTINGS_H
#define DLG_SETTINGS_H
#include <QComboBox>
#include <QCheckBox>
#include <QDialog>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
class CardDatabase;
class QListWidget;
@ -39,14 +45,25 @@ private slots:
private:
QStringList findQmFiles();
QString languageName(const QString &qmFile);
QLineEdit *deckPathEdit, *replaysPathEdit, *picsPathEdit, *cardDatabasePathEdit, *tokenDatabasePathEdit;
QSpinBox *pixmapCacheEdit;
QGroupBox *personalGroupBox, *pathsGroupBox;
QComboBox *languageBox;
QCheckBox *picDownloadCheckBox;
QCheckBox *picDownloadHqCheckBox;
QLabel *languageLabel, *deckPathLabel, *replaysPathLabel, *picsPathLabel, *cardDatabasePathLabel, *tokenDatabasePathLabel, *pixmapCacheLabel;
QPushButton *clearDownloadedPicsButton;
QLineEdit *deckPathEdit;
QLineEdit *replaysPathEdit;
QLineEdit *picsPathEdit;
QLineEdit *cardDatabasePathEdit;
QLineEdit *tokenDatabasePathEdit;
QSpinBox pixmapCacheEdit;
QGroupBox *personalGroupBox;
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 {
@ -69,11 +86,25 @@ signals:
void playerAreaBgChanged(const QString &path);
void cardBackPicturePathChanged(const QString &path);
private:
QLabel *handBgLabel, *stackBgLabel, *tableBgLabel, *playerAreaBgLabel, *cardBackPicturePathLabel, *minPlayersForMultiColumnLayoutLabel;
QLineEdit *handBgEdit, *stackBgEdit, *tableBgEdit, *playerAreaBgEdit, *cardBackPicturePathEdit;
QCheckBox *displayCardNamesCheckBox, *horizontalHandCheckBox, *invertVerticalCoordinateCheckBox, *zoneViewSortByNameCheckBox, *zoneViewSortByTypeCheckBox;
QGroupBox *zoneBgGroupBox, *cardsGroupBox, *handGroupBox, *tableGroupBox, *zoneViewGroupBox;
QSpinBox *minPlayersForMultiColumnLayoutEdit;
QLabel handBgLabel;
QLabel stackBgLabel;
QLabel tableBgLabel;
QLabel playerAreaBgLabel;
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:
AppearanceSettingsPage();
void retranslateUi();
@ -87,15 +118,17 @@ private slots:
signals:
void soundPathChanged();
private:
QCheckBox *notificationsEnabledCheckBox;
QCheckBox *doubleClickToPlayCheckBox;
QCheckBox *playToStackCheckBox;
QCheckBox *tapAnimationCheckBox;
QCheckBox *soundEnabledCheckBox;
QLabel *soundPathLabel;
QCheckBox notificationsEnabledCheckBox;
QCheckBox doubleClickToPlayCheckBox;
QCheckBox playToStackCheckBox;
QCheckBox tapAnimationCheckBox;
QCheckBox soundEnabledCheckBox;
QLabel soundPathLabel;
QLineEdit *soundPathEdit;
QGroupBox *generalGroupBox, *animationGroupBox, *soundGroupBox;
QPushButton *soundTestButton;
QGroupBox *generalGroupBox;
QGroupBox *animationGroupBox;
QGroupBox *soundGroupBox;
QPushButton soundTestButton;
public:
UserInterfaceSettingsPage();
void retranslateUi();
@ -111,8 +144,7 @@ private slots:
signals:
void priceTagSourceChanged(int _priceTagSource);
private:
QCheckBox *priceTagsCheckBox;
QRadioButton *priceTagSource0, *priceTagSource1;
QCheckBox priceTagsCheckBox;
QGroupBox *generalGroupBox;
};
@ -126,8 +158,9 @@ private slots:
void actRemove();
private:
QListWidget *messageList;
QAction *aAdd, *aRemove;
QCheckBox *chatMentionCheckBox;
QAction *aAdd;
QAction *aRemove;
QCheckBox chatMentionCheckBox;
QGroupBox *chatGroupBox;
QGroupBox *messageShortcuts;