1#include "formatterpathwidget.h"
2#include "ui_formatterpathwidget.h"
3#include "../iconsmanager.h"
4#include "../settings.h"
5#include "../systemconsts.h"
6
7#include <QFileDialog>
8
9FormatterPathWidget::FormatterPathWidget(const QString &name, const QString &group, QWidget *parent) :
10 SettingsWidget(name,group,parent),
11 ui(new Ui::FormatterPathWidget)
12{
13 ui->setupUi(this);
14}
15
16FormatterPathWidget::~FormatterPathWidget()
17{
18 delete ui;
19}
20
21void FormatterPathWidget::doLoad()
22{
23 ui->txtAstyle->setText(pSettings->environment().AStylePath());
24}
25
26void FormatterPathWidget::doSave()
27{
28 pSettings->environment().setAStylePath(ui->txtAstyle->text());
29}
30
31void FormatterPathWidget::updateIcons(const QSize &/*size*/)
32{
33 pIconsManager->setIcon(ui->btnChooseAstyle, IconsManager::ACTION_FILE_OPEN_FOLDER);
34}
35
36void FormatterPathWidget::on_btnChooseAstyle_triggered(QAction */*arg1*/)
37{
38 QString fileName = QFileDialog::getOpenFileName(
39 this,
40 tr("Path to astyle"),
41 QString(),
42 tr("All files (%1)").arg(ALL_FILE_WILDCARD));
43 if (!fileName.isEmpty() ) {
44 ui->txtAstyle->setText(fileName);
45 }
46}
47