Added an about dialog
authorTorste Aikio <zokier@zokier.laptop>
Mon, 31 May 2010 09:23:25 +0000 (12:23 +0300)
committerTorste Aikio <zokier@zokier.laptop>
Mon, 31 May 2010 09:23:25 +0000 (12:23 +0300)
src/aboutdlg.cpp [new file with mode: 0644]
src/aboutdlg.h [new file with mode: 0644]
src/selectremotedlg.h
src/settingsdlg.cpp
src/settingsdlg.h
src/src.pro

diff --git a/src/aboutdlg.cpp b/src/aboutdlg.cpp
new file mode 100644 (file)
index 0000000..774ce89
--- /dev/null
@@ -0,0 +1,11 @@
+#include "aboutdlg.h"
+
+AboutDlg::AboutDlg(QWidget *parent)
+    : QDialog(parent)
+{
+}
+
+AboutDlg::~AboutDlg()
+{
+}
+
diff --git a/src/aboutdlg.h b/src/aboutdlg.h
new file mode 100644 (file)
index 0000000..9483751
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef ABOUTDLG_H
+#define ABOUTDLG_H
+
+#include <QDialog>
+
+class QWidget;
+
+class AboutDlg : public QDialog
+{
+    Q_OBJECT
+public:
+    AboutDlg(QWidget *parent);
+    ~AboutDlg();
+};
+
+#endif
+
index 4247154..b7ab807 100644 (file)
@@ -13,6 +13,7 @@ class QNetworkAccessManager;
 class QNetworkReply;
 class QWidget;
 class QPushButton;
+class QLabel;
 
 class SelectRemoteDlg : public QDialog
 {
@@ -46,6 +47,7 @@ private:
     QNetworkAccessManager *remoteNetAM;
     QMap<QString, QString> *deviceNameMap;
     QPushButton *downloadBtn;
+    QLabel *remoteNameLabel;
 
     void beginDownload(const QString &url, QNetworkAccessManager *nam);
     void setBusy(bool busy = true);
index b605923..dccbcfd 100644 (file)
@@ -1,38 +1,60 @@
 #include "settingsdlg.h"
 #include "advsettingsdlg.h"
 #include "selectremotedlg.h"
+#include "aboutdlg.h"
 
 #include <QHBoxLayout>
+#include <QVBoxLayout>
 #include <QWidget>
 #include <QDialog>
 #include <QPushButton>
 #include <QSettings>
+#include <QLabel>
 
 SettingsDlg::SettingsDlg(QWidget *parent)
     : QDialog(parent)
 {
-    layout = new QHBoxLayout(this);
+    layout = new QVBoxLayout(this);
+    btnLayout = new QHBoxLayout(this);
+    remoteNameLayout = new QHBoxLayout(this);
     
     QSettings settings(this);
-    advSettingsBtn = new QPushButton(tr("Advanced..."), this);
-    selectRemoteBtn = new QPushButton(
-            settings.value("remoteName", tr("Select remote")).toString(), this);
+    advSettingsBtn = new QPushButton(tr("Advanced"), this);
+    selectRemoteBtn = new QPushButton(tr("Select remote"), this);
+    aboutBtn = new QPushButton(tr("About"), this);
 
-    layout->addWidget(advSettingsBtn);
-    layout->addWidget(selectRemoteBtn);
+    btnLayout->addWidget(advSettingsBtn);
+    btnLayout->addWidget(selectRemoteBtn);
+    btnLayout->addWidget(aboutBtn);
 
     connect(advSettingsBtn, SIGNAL(clicked()),
             this, SLOT(showAdvSettingsDlg()));
     connect(selectRemoteBtn, SIGNAL(clicked()),
             this, SLOT(showSelectRemoteDlg()));
+    connect(aboutBtn, SIGNAL(clicked()),
+            this, SLOT(showAboutDlg()));
 
+    remoteNameLabel = new QLabel(
+                settings.value("remoteName", 
+                tr("<no remote selected>")).toString(), this);
+    remoteNameLayout->addWidget(new QLabel(tr("Remote name: "), this));
+    remoteNameLayout->addWidget(remoteNameLabel);
+
+    layout->addLayout(remoteNameLayout);
+    layout->addLayout(btnLayout);
     this->setLayout(layout);
+
+    updateRemoteName();
 }
 
 SettingsDlg::~SettingsDlg()
 {
     delete advSettingsBtn;
     delete selectRemoteBtn;
+    delete aboutBtn;
+    delete remoteNameLabel;
+    delete remoteNameLayout;
+    delete btnLayout;
     delete layout;
 }
 
@@ -50,10 +72,16 @@ void SettingsDlg::showSelectRemoteDlg()
     dlg.exec();
 }
 
+void SettingsDlg::showAboutDlg()
+{
+    AboutDlg dlg(this);
+    dlg.exec();
+}
+
 void SettingsDlg::updateRemoteName()
 {
     QSettings settings(this);
-    selectRemoteBtn->setText(settings.value("remoteName", 
+    remoteNameLabel->setText(settings.value("remoteName", 
                 tr("Select remote")).toString());
 }
 
index 3a549d5..aec925a 100644 (file)
@@ -5,7 +5,9 @@
 
 class QWidget;
 class QHBoxLayout;
+class QVBoxLayout;
 class QPushButton;
+class QLabel;
 
 class SettingsDlg : public QDialog
 {
@@ -20,11 +22,16 @@ public slots:
 private slots:
     void showAdvSettingsDlg();
     void showSelectRemoteDlg();
+    void showAboutDlg();
 
 private:
-    QHBoxLayout *layout;
+    QVBoxLayout *layout;
+    QHBoxLayout *btnLayout;
+    QHBoxLayout *remoteNameLayout;
     QPushButton *advSettingsBtn;
     QPushButton *selectRemoteBtn;
+    QPushButton *aboutBtn;
+    QLabel *remoteNameLabel;
 };
 
 #endif
index 1c69bdb..4d5df7b 100644 (file)
@@ -9,6 +9,7 @@ SOURCES += settingsdlg.cpp
 SOURCES += selectremotedlg.cpp
 SOURCES += advsettingsdlg.cpp
 SOURCES += settingstable.cpp
+SOURCES += aboutdlg.cpp
 
 HEADERS += mainwidget.h
 HEADERS += irctrl.h
@@ -17,6 +18,7 @@ HEADERS += settingsdlg.h
 HEADERS += selectremotedlg.h
 HEADERS += advsettingsdlg.h
 HEADERS += settingstable.h
+HEADERS += aboutdlg.h
 
 
 include(qmaemo5homescreenadaptor/qmaemo5homescreenadaptor.pri)