1 #include "settingsdlg.h"
2 #include "advsettingsdlg.h"
3 #include "selectremotedlg.h"
10 #include <QPushButton>
14 SettingsDlg::SettingsDlg(QWidget *parent)
17 layout = new QVBoxLayout(this);
18 btnLayout = new QHBoxLayout(this);
19 remoteNameLayout = new QHBoxLayout(this);
21 QSettings settings(this);
22 advSettingsBtn = new QPushButton(tr("Advanced"), this);
23 selectRemoteBtn = new QPushButton(tr("Select remote"), this);
24 aboutBtn = new QPushButton(tr("About"), this);
26 btnLayout->addWidget(advSettingsBtn);
27 btnLayout->addWidget(selectRemoteBtn);
28 btnLayout->addWidget(aboutBtn);
30 connect(advSettingsBtn, SIGNAL(clicked()),
31 this, SLOT(showAdvSettingsDlg()));
32 connect(selectRemoteBtn, SIGNAL(clicked()),
33 this, SLOT(showSelectRemoteDlg()));
34 connect(aboutBtn, SIGNAL(clicked()),
35 this, SLOT(showAboutDlg()));
37 remoteNameLabel = new QLabel(
38 settings.value("remoteName",
39 tr("<no remote selected>")).toString(), this);
40 remoteNameLayout->addWidget(new QLabel(tr("Remote name: "), this));
41 remoteNameLayout->addWidget(remoteNameLabel);
43 layout->addLayout(remoteNameLayout);
44 layout->addLayout(btnLayout);
45 this->setLayout(layout);
50 SettingsDlg::~SettingsDlg()
52 delete advSettingsBtn;
53 delete selectRemoteBtn;
55 delete remoteNameLabel;
56 delete remoteNameLayout;
61 void SettingsDlg::showAdvSettingsDlg()
63 AdvSettingsDlg dlg(this);
67 void SettingsDlg::showSelectRemoteDlg()
69 SelectRemoteDlg dlg(this);
70 connect(&dlg, SIGNAL(remoteDownloaded()),
71 this, SLOT(updateRemoteName()));
75 void SettingsDlg::showAboutDlg()
81 void SettingsDlg::updateRemoteName()
83 QSettings settings(this);
84 remoteNameLabel->setText(settings.value("remoteName",
85 tr("Select remote")).toString());