#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);
}
#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
FamilyShoppingManagerStartView(QWidget *parent = 0);
~FamilyShoppingManagerStartView();
+private slots:
+ void openListManager();
+ void openGoShopping();
+
private:
Ui::FamilyShoppingManagerStartView *ui;
+ QWidget *activityView;
};
#endif // FAMILYSHOPPINGMANAGERSTARTVIEW_H
</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
<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
#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
#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
<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
#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
#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