1 /* Copyright (c) 2015 Gerald Knizia
2 *
3 * This file is part of the IboView program (see: http://www.iboview.org)
4 *
5 * IboView is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * IboView is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with bfint (LICENSE). If not, see http://www.gnu.org/licenses/
16 *
17 * Please see IboView documentation in README.txt for:
18 * -- A list of included external software and their licenses. The included
19 * external software's copyright is not touched by this agreement.
20 * -- Notes on re-distribution and contributions to/further development of
21 * the IboView software
22 */
23
24 #include "Iv.h"
25 #include "IvPreferencesForm.h"
26 #include "IvSettings.h"
27 // #include "QPropertyModel.h"
28 #include "ui_PreferencesForm.h"
29 #include <QSettings>
30 #include <QFileDialog>
31
FPreferencesForm(FDocument * document,QWidget * parent)32 FPreferencesForm::FPreferencesForm(FDocument *document, QWidget *parent)
33 : QDialog(parent),
34 ui(new Ui::PreferencesForm),
35 m_pDocument(document)
36 {
37 ui->setupUi(this);
38 connect(ui->toolButton_ClearScriptFile, SIGNAL(clicked()), this, SLOT(ClearStartupScriptFile()));
39 connect(ui->toolButton_FindScriptFile, SIGNAL(clicked()), this, SLOT(SearchStartupScriptFile()));
40
41 QSettings
42 settings;
43 ui->lineEdit_StartupScriptFile->setText(settings.value("IboView/StartupScriptFile").toString());
44 }
45
46
47
~FPreferencesForm()48 FPreferencesForm::~FPreferencesForm()
49 {
50 delete ui;
51 }
52
accept()53 void FPreferencesForm::accept()
54 {
55 QSettings
56 settings;
57 settings.setValue("IboView/StartupScriptFile", ui->lineEdit_StartupScriptFile->text());
58 return QDialog::accept();
59 }
60
ClearStartupScriptFile()61 void FPreferencesForm::ClearStartupScriptFile()
62 {
63 ui->lineEdit_StartupScriptFile->setText("");
64 }
65
SearchStartupScriptFile()66 void FPreferencesForm::SearchStartupScriptFile()
67 {
68 QString FileName = QFileDialog::getOpenFileName(this, "Select Script File",
69 "", "IboView Scripts (*.js);;All Files (*.*)");
70 if (!FileName.isEmpty())
71 ui->lineEdit_StartupScriptFile->setText(FileName);
72 }
73