17#include "presetdialog.h"
18#include "ui_presetdialog.h"
21#include <QStandardPaths>
34 hideQuestionMark(*
this);
37PresetDialog::~PresetDialog()
42int PresetDialog::getPresetIndex()
45 int index = ui->presetComboBox->currentData().toInt(&ok);
50bool PresetDialog::shouldAlwaysUse()
52 return ui->alwaysUse->isChecked();
55QString PresetDialog::getPresetPath(
int index)
64 if (dataDir.
cd(
"presets"))
71void PresetDialog::initPresets()
75 QDir dataDir(dataPath);
76 dataDir.
mkdir(
"presets");
77 if (dataDir.
cd(
"presets") ==
false)
84 int defaultIndex = mPrefs->getInt(SETTING::DEFAULT_PRESET);
85 ui->presetComboBox->addItem(
"Default", 0);
86 ui->presetComboBox->setCurrentIndex(0);
88 if (!dataDir.
exists(
"presets.ini"))
96 for (
const QString& key : presets.allKeys())
98 int index = key.toInt(&ok);
99 if (!ok || index == 0 || !dataDir.
exists(
QString(
"%1.pclx").arg(index)))
continue;
103 ui->presetComboBox->addItem(name, index);
104 if (index == defaultIndex)
106 ui->presetComboBox->setCurrentIndex(ui->presetComboBox->count()-1);
110 ui->presetComboBox->model()->sort(0);
bool cd(const QString &dirName)
bool exists() const const
QString filePath(const QString &fileName) const const
bool mkdir(const QString &dirName) const const
QString writableLocation(QStandardPaths::StandardLocation type)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
bool isEmpty() const const