make custom sets directory configurable (#4047)
This commit is contained in:
parent
feee9cc328
commit
964207d04f
6 changed files with 40 additions and 4 deletions
|
@ -116,6 +116,11 @@ GeneralSettingsPage::GeneralSettingsPage()
|
|||
QPushButton *cardDatabasePathButton = new QPushButton("...");
|
||||
connect(cardDatabasePathButton, SIGNAL(clicked()), this, SLOT(cardDatabasePathButtonClicked()));
|
||||
|
||||
customCardDatabasePathEdit = new QLineEdit(SettingsCache::instance().getCustomCardDatabasePath());
|
||||
customCardDatabasePathEdit->setReadOnly(true);
|
||||
QPushButton *customCardDatabasePathButton = new QPushButton("...");
|
||||
connect(customCardDatabasePathButton, SIGNAL(clicked()), this, SLOT(customCardDatabaseButtonClicked()));
|
||||
|
||||
tokenDatabasePathEdit = new QLineEdit(SettingsCache::instance().getTokenDatabasePath());
|
||||
tokenDatabasePathEdit->setReadOnly(true);
|
||||
QPushButton *tokenDatabasePathButton = new QPushButton("...");
|
||||
|
@ -126,12 +131,14 @@ GeneralSettingsPage::GeneralSettingsPage()
|
|||
replaysPathEdit->setEnabled(false);
|
||||
picsPathEdit->setEnabled(false);
|
||||
cardDatabasePathEdit->setEnabled(false);
|
||||
customCardDatabasePathEdit->setEnabled(false);
|
||||
tokenDatabasePathEdit->setEnabled(false);
|
||||
|
||||
deckPathButton->setVisible(false);
|
||||
replaysPathButton->setVisible(false);
|
||||
picsPathButton->setVisible(false);
|
||||
cardDatabasePathButton->setVisible(false);
|
||||
customCardDatabasePathEdit->setVisible(false);
|
||||
tokenDatabasePathButton->setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -148,9 +155,12 @@ GeneralSettingsPage::GeneralSettingsPage()
|
|||
pathsGrid->addWidget(&cardDatabasePathLabel, 3, 0);
|
||||
pathsGrid->addWidget(cardDatabasePathEdit, 3, 1);
|
||||
pathsGrid->addWidget(cardDatabasePathButton, 3, 2);
|
||||
pathsGrid->addWidget(&tokenDatabasePathLabel, 4, 0);
|
||||
pathsGrid->addWidget(tokenDatabasePathEdit, 4, 1);
|
||||
pathsGrid->addWidget(tokenDatabasePathButton, 4, 2);
|
||||
pathsGrid->addWidget(&customCardDatabasePathLabel, 4, 0);
|
||||
pathsGrid->addWidget(customCardDatabasePathEdit, 4, 1);
|
||||
pathsGrid->addWidget(customCardDatabasePathButton, 4, 2);
|
||||
pathsGrid->addWidget(&tokenDatabasePathLabel, 5, 0);
|
||||
pathsGrid->addWidget(tokenDatabasePathEdit, 5, 1);
|
||||
pathsGrid->addWidget(tokenDatabasePathButton, 5, 2);
|
||||
pathsGroupBox = new QGroupBox;
|
||||
pathsGroupBox->setLayout(pathsGrid);
|
||||
|
||||
|
@ -220,6 +230,16 @@ void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
|||
SettingsCache::instance().setCardDatabasePath(path);
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::customCardDatabaseButtonClicked()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose path"), customCardDatabasePathEdit->text());
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
customCardDatabasePathEdit->setText(path);
|
||||
SettingsCache::instance().setCustomCardDatabasePath(path);
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"), tokenDatabasePathEdit->text());
|
||||
|
@ -250,6 +270,7 @@ void GeneralSettingsPage::retranslateUi()
|
|||
replaysPathLabel.setText(tr("Replays directory:"));
|
||||
picsPathLabel.setText(tr("Pictures directory:"));
|
||||
cardDatabasePathLabel.setText(tr("Card database:"));
|
||||
customCardDatabasePathLabel.setText(tr("Custom database directory:"));
|
||||
tokenDatabasePathLabel.setText(tr("Token database:"));
|
||||
pixmapCacheLabel.setText(tr("Picture cache size:"));
|
||||
updateReleaseChannelLabel.setText(tr("Update channel"));
|
||||
|
|
|
@ -42,6 +42,7 @@ private slots:
|
|||
void replaysPathButtonClicked();
|
||||
void picsPathButtonClicked();
|
||||
void cardDatabasePathButtonClicked();
|
||||
void customCardDatabaseButtonClicked();
|
||||
void tokenDatabasePathButtonClicked();
|
||||
void languageBoxChanged(int index);
|
||||
|
||||
|
@ -52,6 +53,7 @@ private:
|
|||
QLineEdit *replaysPathEdit;
|
||||
QLineEdit *picsPathEdit;
|
||||
QLineEdit *cardDatabasePathEdit;
|
||||
QLineEdit *customCardDatabasePathEdit;
|
||||
QLineEdit *tokenDatabasePathEdit;
|
||||
QSpinBox pixmapCacheEdit;
|
||||
QGroupBox *personalGroupBox;
|
||||
|
@ -66,6 +68,7 @@ private:
|
|||
QLabel replaysPathLabel;
|
||||
QLabel picsPathLabel;
|
||||
QLabel cardDatabasePathLabel;
|
||||
QLabel customCardDatabasePathLabel;
|
||||
QLabel tokenDatabasePathLabel;
|
||||
QLabel updateReleaseChannelLabel;
|
||||
QCheckBox showTipsOnStartup;
|
||||
|
|
|
@ -203,7 +203,6 @@ SettingsCache::SettingsCache()
|
|||
} else {
|
||||
customPicsPath = getSafeConfigPath("paths/custompics", picsPath + "/CUSTOM/");
|
||||
}
|
||||
// this has never been exposed as an user-configurable setting
|
||||
customCardDatabasePath = getSafeConfigPath("paths/customsets", dataPath + "/customsets/");
|
||||
|
||||
cardDatabasePath = getSafeConfigFilePath("paths/carddatabase", dataPath + "/cards.xml");
|
||||
|
@ -387,6 +386,12 @@ void SettingsCache::setReplaysPath(const QString &_replaysPath)
|
|||
settings->setValue("paths/replays", replaysPath);
|
||||
}
|
||||
|
||||
void SettingsCache::setCustomCardDatabasePath(const QString &_customCardDatabasePath)
|
||||
{
|
||||
customCardDatabasePath = _customCardDatabasePath;
|
||||
settings->setValue("paths/customsets", customCardDatabasePath);
|
||||
}
|
||||
|
||||
void SettingsCache::setPicsPath(const QString &_picsPath)
|
||||
{
|
||||
picsPath = _picsPath;
|
||||
|
|
|
@ -474,6 +474,7 @@ public slots:
|
|||
void setSeenTips(const QList<int> &_seenTips);
|
||||
void setDeckPath(const QString &_deckPath);
|
||||
void setReplaysPath(const QString &_replaysPath);
|
||||
void setCustomCardDatabasePath(const QString &_customCardDatabasePath);
|
||||
void setPicsPath(const QString &_picsPath);
|
||||
void setCardDatabasePath(const QString &_cardDatabasePath);
|
||||
void setSpoilerDatabasePath(const QString &_spoilerDatabasePath);
|
||||
|
|
|
@ -102,6 +102,9 @@ void SettingsCache::setPicsPath(const QString &/* _picsPath */)
|
|||
void SettingsCache::setCardDatabasePath(const QString &/* _cardDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setCustomCardDatabasePath(const QString &/* _customCardDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpoilerDatabasePath(const QString &/* _spoilerDatabasePath */)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -106,6 +106,9 @@ void SettingsCache::setPicsPath(const QString &/* _picsPath */)
|
|||
void SettingsCache::setCardDatabasePath(const QString &/* _cardDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setCustomCardDatabasePath(const QString &/* _customCardDatabasePath */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setSpoilerDatabasePath(const QString &/* _spoilerDatabasePath */)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue