Update async methods! Now valid ip is detected
[vlc-remote] / configdialog.cpp
1 /*   VLC-REMOTE for MAEMO 5
2  *   Copyright (C) 2010 Schutz Sacha <istdasklar@gmail.com>
3  *   This program is free software; you can redistribute it and/or modify
4  *   it under the terms of the GNU General Public License version 2,
5  *   or (at your option) any later version, as published by the Free
6  *   Software Foundation
7  *
8  *   This program is distributed in the hope that it will be useful,
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *   GNU General Public License for more details
12  *
13  *   You should have received a copy of the GNU General Public
14  *   License along with this program; if not, write to the
15  *   Free Software Foundation, Inc.,
16  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 #include "configdialog.h"
19 #include "ui_configdialog.h"
20 #include <QSettings>
21
22 ConfigDialog::ConfigDialog(QWidget *parent) :
23         QDialog(parent),
24         ui(new Ui::ConfigDialog)
25 {
26     ui->setupUi(this);
27     load();
28     connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(save()));
29 }
30
31 ConfigDialog::~ConfigDialog()
32 {
33     delete ui;
34 }
35
36 void ConfigDialog::changeEvent(QEvent *e)
37 {
38     QDialog::changeEvent(e);
39     switch (e->type()) {
40     case QEvent::LanguageChange:
41         ui->retranslateUi(this);
42         break;
43     default:
44         break;
45     }
46 }
47 void ConfigDialog::load()
48 {
49     QSettings settings;
50     ui->lineEdit->setText(settings.value("ip").toString());
51
52 }
53
54 void ConfigDialog::save()
55 {
56
57     QSettings settings;
58     settings.setValue("ip",ui->lineEdit->text());
59
60     emit accept();
61 }