mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-27 17:13:54 -07:00
make more use of SettingsCache
This commit is contained in:
parent
2c9a8c2b57
commit
e9a0203880
10 changed files with 106 additions and 48 deletions
|
|
@ -169,28 +169,25 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
{
|
||||
zoneBgGroupBox = new QGroupBox;
|
||||
QSettings settings;
|
||||
settings.beginGroup("zonebg");
|
||||
|
||||
handBgLabel = new QLabel;
|
||||
handBgEdit = new QLineEdit(settings.value("hand").toString());
|
||||
handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
|
||||
handBgEdit->setReadOnly(true);
|
||||
QPushButton *handBgButton = new QPushButton("...");
|
||||
connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));
|
||||
|
||||
tableBgLabel = new QLabel;
|
||||
tableBgEdit = new QLineEdit(settings.value("table").toString());
|
||||
tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
|
||||
tableBgEdit->setReadOnly(true);
|
||||
QPushButton *tableBgButton = new QPushButton("...");
|
||||
connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));
|
||||
|
||||
playerAreaBgLabel = new QLabel;
|
||||
playerAreaBgEdit = new QLineEdit(settings.value("playerarea").toString());
|
||||
playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
|
||||
playerAreaBgEdit->setReadOnly(true);
|
||||
QPushButton *playerAreaBgButton = new QPushButton("...");
|
||||
connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));
|
||||
|
||||
settings.endGroup();
|
||||
|
||||
QGridLayout *zoneBgGrid = new QGridLayout;
|
||||
zoneBgGrid->addWidget(handBgLabel, 0, 0);
|
||||
zoneBgGrid->addWidget(handBgEdit, 0, 1);
|
||||
|
|
@ -256,12 +253,9 @@ void AppearanceSettingsPage::handBgButtonClicked()
|
|||
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
QSettings settings;
|
||||
settings.beginGroup("zonebg");
|
||||
settings.setValue("hand", path);
|
||||
handBgEdit->setText(path);
|
||||
|
||||
emit handBgChanged(path);
|
||||
handBgEdit->setText(path);
|
||||
settingsCache->setHandBgPath(path);
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::tableBgButtonClicked()
|
||||
|
|
@ -269,12 +263,9 @@ void AppearanceSettingsPage::tableBgButtonClicked()
|
|||
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
QSettings settings;
|
||||
settings.beginGroup("zonebg");
|
||||
settings.setValue("table", path);
|
||||
|
||||
tableBgEdit->setText(path);
|
||||
|
||||
emit tableBgChanged(path);
|
||||
settingsCache->setTableBgPath(path);
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::playerAreaBgButtonClicked()
|
||||
|
|
@ -282,12 +273,9 @@ void AppearanceSettingsPage::playerAreaBgButtonClicked()
|
|||
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
QSettings settings;
|
||||
settings.beginGroup("zonebg");
|
||||
settings.setValue("playerarea", path);
|
||||
playerAreaBgEdit->setText(path);
|
||||
|
||||
emit playerAreaBgChanged(path);
|
||||
playerAreaBgEdit->setText(path);
|
||||
settingsCache->setPlayerBgPath(path);
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::zoneViewSortingCheckBoxChanged(int state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue