git-svn-id: file:///svnroot/family-shop-mgr@14 26eb2498-383b-47a6-be48-5d6f36779e85
authoronil <u.irigoyen@gmail.com>
Thu, 17 Dec 2009 16:45:24 +0000 (16:45 +0000)
committeronil <u.irigoyen@gmail.com>
Thu, 17 Dec 2009 16:45:24 +0000 (16:45 +0000)
code/family-shop-mgr/FamilyShoppingManagerStartView.cpp
code/family-shop-mgr/FamilyShoppingManagerStartView.h
code/family-shop-mgr/FamilyShoppingManagerStartView.ui
code/family-shop-mgr/GoShopping.ui
code/family-shop-mgr/GoShoppingView.cpp
code/family-shop-mgr/GoShoppingView.h
code/family-shop-mgr/ListManager.ui
code/family-shop-mgr/ListManagerView.cpp
code/family-shop-mgr/ListManagerView.h

index b3d944d..4265334 100644 (file)
 #include "FamilyShoppingManagerStartView.h"
 #include "ui_FamilyShoppingManagerStartView.h"
 
+#include "ListManagerView.h"
+#include "GoShoppingView.h"
+
 FamilyShoppingManagerStartView::FamilyShoppingManagerStartView(QWidget *parent)
-    : QWidget(parent), ui(new Ui::FamilyShoppingManagerStartView)
+    : QDialog(parent), ui(new Ui::FamilyShoppingManagerStartView), activityView(NULL)
 {
     ui->setupUi(this);
+    connect(ui->manageButton, SIGNAL(clicked()), this, SLOT(openListManager()));
+    connect(ui->goShoppingButton, SIGNAL(clicked()), this, SLOT(openGoShopping()));
 }
 
 FamilyShoppingManagerStartView::~FamilyShoppingManagerStartView()
 {
     delete ui;
+    delete activityView;
+}
+
+void FamilyShoppingManagerStartView::openListManager()
+{
+    this->hide();
+    activityView = new ListManagerView("ShoppingList.xml", this);
+}
+
+void FamilyShoppingManagerStartView::openGoShopping()
+{
+    //this->hide();
+    activityView = new GoShoppingView("ShoppingList.xml", this);
 }
index 168828f..b8f22b7 100644 (file)
 #ifndef FAMILYSHOPPINGMANAGERSTARTVIEW_H
 #define FAMILYSHOPPINGMANAGERSTARTVIEW_H
 
-#include <QtGui/QWidget>
+#include <QDialog>
 
 namespace Ui
 {
     class FamilyShoppingManagerStartView;
 }
 
-class FamilyShoppingManagerStartView : public QWidget
+class FamilyShoppingManagerStartView : public QDialog
 {
     Q_OBJECT
 
@@ -37,8 +37,13 @@ public:
     FamilyShoppingManagerStartView(QWidget *parent = 0);
     ~FamilyShoppingManagerStartView();
 
+private slots:
+    void openListManager();
+    void openGoShopping();
+
 private:
     Ui::FamilyShoppingManagerStartView *ui;
+    QWidget *activityView;
 };
 
 #endif // FAMILYSHOPPINGMANAGERSTARTVIEW_H
index bbc601d..607a0fa 100644 (file)
@@ -106,7 +106,7 @@ shopping list</string>
     </layout>\r
    </item>\r
    <item>\r
-    <widget class="QLabel" name="label">\r
+    <widget class="QLabel" name="authorLabel">\r
      <property name="font">\r
       <font>\r
        <pointsize>7</pointsize>\r
index b756f7d..a000670 100644 (file)
@@ -20,7 +20,7 @@
    <item>\r
     <layout class="QHBoxLayout" name="horizontalLayout">\r
      <item>\r
-      <widget class="QPushButton" name="pushButton">\r
+      <widget class="QPushButton" name="showCheckedPushButton">\r
        <property name="locale">\r
         <locale language="English" country="UnitedStates"/>\r
        </property>\r
index e841f7d..5304afa 100644 (file)
 #include "GoShoppingView.h"\r
 #include "ui_GoShopping.h"\r
 \r
-GoShoppingView::GoShoppingView(QWidget *parent)\r
-    :QWidget(parent), ui(new Ui::GoShoppingView)\r
+#include "ShoppingTreeModel.h"\r
+\r
+GoShoppingView::GoShoppingView(QString xmlFileName, QWidget *parent)\r
+    :QDialog(parent), ui(new Ui::GoShoppingView)\r
 {\r
     ui->setupUi(this);\r
+    ShoppingTreeModel *model = new ShoppingTreeModel(xmlFileName, this);\r
+    ui->treeView->setModel(model);\r
+    for(int column = 0; column < model->columnCount(); column++)\r
+        ui->treeView->resizeColumnToContents(column);\r
 }\r
 \r
 GoShoppingView::~GoShoppingView()\r
index c91ad79..fad1591 100644 (file)
 #ifndef GOSHOPPINGVIEW_H\r
 #define GOSHOPPINGVIEW_H\r
 \r
-#include <QtGui/QWidget>\r
+#include <QDialog>\r
 \r
 namespace Ui\r
 {\r
     class GoShoppingView;\r
 }\r
 \r
-class GoShoppingView : public QWidget\r
+class GoShoppingView : public QDialog\r
 {\r
 Q_OBJECT\r
 \r
 public:\r
-    GoShoppingView(QWidget *parent = 0);\r
+    GoShoppingView(QString xmlFileName, QWidget *parent = 0);\r
     ~GoShoppingView();\r
 \r
 private:\r
index 39751ad..bcf0e81 100644 (file)
@@ -20,7 +20,7 @@
    <item>\r
     <layout class="QHBoxLayout" name="horizontalLayout">\r
      <item>\r
-      <widget class="QPushButton" name="pushButton">\r
+      <widget class="QPushButton" name="editStructurePushButton">\r
        <property name="text">\r
         <string>Edit structure</string>\r
        </property>\r
       </widget>\r
      </item>\r
      <item>\r
-      <widget class="QPushButton" name="pushButton_3">\r
+      <widget class="QPushButton" name="addPushButton">\r
+       <property name="enabled">\r
+        <bool>false</bool>\r
+       </property>\r
        <property name="text">\r
         <string>Add</string>\r
        </property>\r
       </widget>\r
      </item>\r
      <item>\r
-      <widget class="QPushButton" name="pushButton_2">\r
+      <widget class="QPushButton" name="removePushButton">\r
+       <property name="enabled">\r
+        <bool>false</bool>\r
+       </property>\r
        <property name="text">\r
         <string>Remove</string>\r
        </property>\r
index d602753..38525f7 100644 (file)
 #include "ListManagerView.h"\r
 #include "ui_ListManager.h"\r
 \r
-ListManagerView::ListManagerView(QWidget *parent)\r
-    :QWidget(parent), ui(new Ui::ListManagerView)\r
+#include "ShoppingTreeModel.h"\r
+\r
+ListManagerView::ListManagerView(QString xmlFileName, QWidget *parent)\r
+    :QDialog(parent), ui(new Ui::ListManagerView)\r
 {\r
     ui->setupUi(this);\r
+    ShoppingTreeModel *model = new ShoppingTreeModel(xmlFileName, this);\r
+    ui->treeView->setModel(model);\r
+    for(int column = 0; column < model->columnCount(); column++)\r
+        ui->treeView->resizeColumnToContents(column);\r
+\r
+    show();\r
 }\r
 \r
 ListManagerView::~ListManagerView()\r
 {\r
     delete ui;\r
 }\r
+\r
+void ListManagerView::updateActions()\r
+{\r
+    bool hasSelection = !ui->treeView->selectionModel()->selection().isEmpty();\r
+\r
+}\r
index a91263a..bd32332 100644 (file)
 #ifndef LISTMANAGERVIEW_H\r
 #define LISTMANAGERVIEW_H\r
 \r
-#include <QtGui/QWidget>\r
+#include <QDialog>\r
 \r
 namespace Ui\r
 {\r
     class ListManagerView;\r
 }\r
 \r
-class ListManagerView : public QWidget\r
+class ListManagerView : public QDialog\r
 {\r
 Q_OBJECT\r
 \r
 public:\r
-    ListManagerView(QWidget *parent = 0);\r
+    ListManagerView(QString xmlFileName, QWidget *parent = 0);\r
     ~ListManagerView();\r
 \r
 private:\r
     Ui::ListManagerView *ui;\r
+\r
+    void updateActions();\r
 };\r
 \r
 #endif // LISTMANAGERVIEW_H\r