diff options
Diffstat (limited to '')
-rw-r--r-- | LayoutStudio.pro | 6 | ||||
-rw-r--r-- | lslayoutwindow.cpp | 46 | ||||
-rw-r--r-- | lslayoutwindow.h | 32 | ||||
-rw-r--r-- | lsmainwindow.cpp | 19 | ||||
-rw-r--r-- | lsmainwindow.h | 1 |
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; |