Added settings dialog
authorTorste Aikio <zokier@zokier.laptop>
Wed, 19 May 2010 13:12:10 +0000 (16:12 +0300)
committerTorste Aikio <zokier@zokier.laptop>
Wed, 19 May 2010 13:12:10 +0000 (16:12 +0300)
src/irctrl.cpp
src/irctrl.h
src/irw.pro
src/mainwidget.cpp
src/settingsdlg.cpp [new file with mode: 0644]
src/settingsdlg.h [new file with mode: 0644]

index b0a821f..079c633 100644 (file)
@@ -4,6 +4,11 @@ IrCtrl::IrCtrl()
 {
 }
 
+void IrCtrl::setRemoteName(const QString &newRemoteName)
+{
+    this->remoteName = newRemoteName;
+}
+
 void IrCtrl::sendCmd0(bool)
 {
 }
index aee214d..13ef634 100644 (file)
@@ -2,6 +2,7 @@
 #define IRCTRL_H
 
 #include <QObject>
+#include <QString>
 
 class IrCtrl : public QObject
 {
@@ -9,6 +10,8 @@ class IrCtrl : public QObject
 public:
     IrCtrl();
 
+    void setRemoteName(const QString &newRemoteName);
+
 public slots:
     void sendCmd0(bool);
     void sendCmd1(bool);
@@ -16,6 +19,9 @@ public slots:
     void sendCmd3(bool);
     void sendCmd4(bool);
     void sendCmd5(bool);
+
+private:
+    QString remoteName;
 };
 
 #endif
index 9309975..2791076 100644 (file)
@@ -3,8 +3,10 @@ TEMPLATE = app
 SOURCES += main.cpp
 SOURCES += mainwidget.cpp
 SOURCES += irctrl.cpp
+SOURCES += settingsdlg.cpp
 HEADERS += mainwidget.h
 HEADERS += irctrl.h
+HEADERS += settingsdlg.h
 
 include(qmaemo5homescreenadaptor/qmaemo5homescreenadaptor.pri)
 
index a1e9fbc..b938991 100644 (file)
@@ -4,6 +4,8 @@
 #include <QGridLayout>
 #include <QPushButton>
 
+#include "settingsdlg.h"
+
 MainWidget::MainWidget (QWidget *parent)
     : QWidget(parent)
 {
@@ -28,12 +30,11 @@ MainWidget::MainWidget (QWidget *parent)
 
 void MainWidget::showSettingsDialog()
 {
-    bool isOk;
-    QString newText = QInputDialog::getText(this, tr("New Text"),
-            tr("Please enter a new text:"), QLineEdit::Normal,
-            "foo", &isOk);
-//    if (isOk)
-//        setText(newText);
+    SettingsDlg dlg(this);
+    if (dlg.exec() == QDialog::Accepted)
+    {
+        irCtrl.setRemoteName(dlg.getRemoteName());
+    }
 }
 
 
diff --git a/src/settingsdlg.cpp b/src/settingsdlg.cpp
new file mode 100644 (file)
index 0000000..031aaec
--- /dev/null
@@ -0,0 +1,26 @@
+#include "settingsdlg.h"
+
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QString>
+
+SettingsDlg::SettingsDlg(QWidget *parent)
+    : QDialog(parent)
+{
+    layout = new QHBoxLayout(this);
+    layout->addWidget(new QLabel("foo"));
+    layout->addWidget(new QLabel("bar"));
+    layout->addWidget(new QLabel("baz"));
+    this->setLayout(layout);
+}
+
+SettingsDlg::~SettingsDlg()
+{
+    delete layout;
+}
+
+QString& SettingsDlg::getRemoteName()
+{
+    return remoteName;
+}
+
diff --git a/src/settingsdlg.h b/src/settingsdlg.h
new file mode 100644 (file)
index 0000000..8807e02
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef SETTINGSDLG_H
+#define SETTINGSDLG_H
+
+#include <QDialog>
+#include <QString>
+
+class QHBoxLayout;
+
+class SettingsDlg : public QDialog
+{
+    Q_OBJECT
+public:
+    SettingsDlg(QWidget *parent = 0);
+    ~SettingsDlg();
+
+    QString& getRemoteName();
+
+private:
+    QHBoxLayout *layout;
+    QString remoteName;
+};
+
+#endif
+