summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-08-04 18:19:19 +0200
committerTreeki <treeki@gmail.com>2012-08-04 18:19:19 +0200
commitcee09c07899dfec32672e7e2d175972530a7dfd4 (patch)
treeb3e4b1a0960ed1b95e2b838b5bfa4b9f132ff2c8
parent362976328ecb796d670b32af924f76e25922cb78 (diff)
downloadLayoutStudio-cee09c07899dfec32672e7e2d175972530a7dfd4.tar.gz
LayoutStudio-cee09c07899dfec32672e7e2d175972530a7dfd4.zip
this bit is nowhere near finished but I'm pushing it so I can pull on my netbook
-rw-r--r--LayoutStudio.pro6
-rw-r--r--lslayoutwindow.cpp46
-rw-r--r--lslayoutwindow.h32
-rw-r--r--lsmainwindow.cpp19
-rw-r--r--lsmainwindow.h1
5 files changed, 102 insertions, 2 deletions
diff --git a/LayoutStudio.pro b/LayoutStudio.pro
index 815dcdc..1ec2b7d 100644
--- a/LayoutStudio.pro
+++ b/LayoutStudio.pro
@@ -36,7 +36,8 @@ SOURCES += main.cpp \
layoutgl/texturemanager.cpp \
layoutgl/widget.cpp \
wii/texpalette.cpp \
- lspackagemodel.cpp
+ lspackagemodel.cpp \
+ lslayoutwindow.cpp
HEADERS += lsmainwindow.h \
lsglobals.h \
lyt/packagebase.h \
@@ -71,7 +72,8 @@ HEADERS += lsmainwindow.h \
layoutgl/widget.h \
wii/texpalette.h \
wii/gx.h \
- lspackagemodel.h
+ lspackagemodel.h \
+ lslayoutwindow.h
FORMS +=
RESOURCES += resources.qrc
diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp
new file mode 100644
index 0000000..25baf41
--- /dev/null
+++ b/lslayoutwindow.cpp
@@ -0,0 +1,46 @@
+#include "lslayoutwindow.h"
+#include <QGridLayout>
+#include <QFormLayout>
+#include <QGroupBox>
+
+LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, QWidget *parent) :
+ QMainWindow(parent) {
+
+ m_layoutName = layoutName;
+ m_package = pkg;
+
+
+ m_tabWidget = new QTabWidget(this);
+ setCentralWidget(m_tabWidget);
+
+ QWidget *w;
+
+ // prepare the Settings tab
+ w = new QWidget(this);
+ QGridLayout *sgrid = new QGridLayout(w);
+
+ QGroupBox *sizeGroup = new QGroupBox("Layout Size", this);
+ sgrid->addWidget(sizeGroup, 0, 0, 1, 2);
+
+ QFormLayout *sizeForm = new QFormLayout(sizeGroup);
+
+ m_widthBox = new QDoubleSpinBox(this);
+ m_widthBox->setRange(0.0, 1000.0);
+ m_heightBox = new QDoubleSpinBox(this);
+ m_heightBox->setRange(0.0, 1000.0);
+
+ sizeForm->addRow("Width", m_widthBox);
+ sizeForm->addRow("Height", m_heightBox);
+
+
+ QGroupBox *matGroup = new QGroupBox("Materials", this);
+ QGroupBox *grpGroup = new QGroupBox("Groups", this);
+
+ sgrid->addWidget(matGroup, 1, 0, 1, 1);
+ sgrid->addWidget(grpGroup, 1, 1, 1, 1);
+ sgrid->setRowStretch(1, 1);
+
+ m_tabWidget->addTab(w, "Settings");
+}
+
+
diff --git a/lslayoutwindow.h b/lslayoutwindow.h
new file mode 100644
index 0000000..51158a0
--- /dev/null
+++ b/lslayoutwindow.h
@@ -0,0 +1,32 @@
+#ifndef LSLAYOUTWINDOW_H
+#define LSLAYOUTWINDOW_H
+
+#include <QMainWindow>
+#include <QTabWidget>
+#include <QDoubleSpinBox>
+#include "lyt/packagebase.h"
+
+class LSLayoutWindow : public QMainWindow {
+ Q_OBJECT
+public:
+ explicit LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, QWidget *parent = 0);
+
+ QString layoutName() const { return m_layoutName; }
+ // TODO: set layoutname method
+
+private:
+ QString m_layoutName;
+ LYTPackageBase *m_package;
+
+ QTabWidget *m_tabWidget;
+
+ // settings
+ QDoubleSpinBox *m_widthBox, *m_heightBox;
+
+signals:
+
+public slots:
+
+};
+
+#endif // LSLAYOUTWINDOW_H
diff --git a/lsmainwindow.cpp b/lsmainwindow.cpp
index 66c51b3..4e6af5f 100644
--- a/lsmainwindow.cpp
+++ b/lsmainwindow.cpp
@@ -22,6 +22,7 @@
#include <QInputDialog>
#include <QMessageBox>
#include "lyt/archivepackage.h"
+#include "lslayoutwindow.h"
LSMainWindow::LSMainWindow(QWidget *parent) : QMainWindow(parent) {
m_package = 0;
@@ -33,6 +34,8 @@ LSMainWindow::LSMainWindow(QWidget *parent) : QMainWindow(parent) {
m_view = new QTreeView(this);
setCentralWidget(m_view);
+ connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(handleItemActivated(QModelIndex)));
+
newArchive();
}
@@ -183,6 +186,22 @@ LYTPackageBase::ItemType LSMainWindow::selectedItemType() const {
}
+void LSMainWindow::handleItemActivated(const QModelIndex &index) {
+ QString what = selectedItem();
+ LYTPackageBase::ItemType whatType = selectedItemType();
+
+ if (what.isEmpty())
+ return;
+
+ switch (whatType) {
+ case LYTPackageBase::Layout:
+ LSLayoutWindow *w = new LSLayoutWindow(m_package, what);
+ w->show();
+ break;
+ }
+}
+
+
bool LSMainWindow::ensureSaved() {
// TODO
return false;
diff --git a/lsmainwindow.h b/lsmainwindow.h
index 745b4f2..639725b 100644
--- a/lsmainwindow.h
+++ b/lsmainwindow.h
@@ -46,6 +46,7 @@ private slots:
void handleAddSomething(int whatToAdd);
void handleRenameItem();
void handleRemoveItem();
+ void handleItemActivated(const QModelIndex &index);
private:
LYTPackageBase *m_package;