File indexing completed on 2024-06-09 05:33:24
0001 #include "preferencesdialog.h" 0002 #include "ui_preferencesdialog.h" 0003 0004 #include <QFileDialog> 0005 0006 PreferencesDialog::PreferencesDialog(QWidget *parent) : 0007 QDialog(parent), 0008 ui(new Ui::PreferencesDialog) 0009 { 0010 ui->setupUi(this); 0011 0012 connect(ui->m_selectDirectory,SIGNAL(clicked(bool)),this,SLOT(selectDir())); 0013 } 0014 0015 PreferencesDialog::~PreferencesDialog() 0016 { 0017 //delete ui; 0018 qDebug() << "delete preferenceDialgog"; 0019 } 0020 0021 QString PreferencesDialog::generationPath() const 0022 { 0023 return ui->m_dirPath->text(); 0024 } 0025 0026 void PreferencesDialog::setGenerationPath(const QString &generationPath) 0027 { 0028 ui->checkBox->setCheckState(Qt::Checked); 0029 ui->m_dirPath->setText(generationPath); 0030 } 0031 bool PreferencesDialog::hasCustomPath() 0032 { 0033 return (ui->checkBox->checkState() == Qt::Checked); 0034 } 0035 void PreferencesDialog::selectDir() 0036 { 0037 QString path = QFileDialog::getExistingDirectory(this,tr("Directory to save QML file"),tr("Place to save Generated files")); 0038 if(!path.isEmpty()) 0039 { 0040 ui->m_dirPath->setText(path); 0041 } 0042 }