diff options
Diffstat (limited to 'lsmainwindow.cpp')
-rw-r--r-- | lsmainwindow.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lsmainwindow.cpp b/lsmainwindow.cpp index 1d13a50..91bbf50 100644 --- a/lsmainwindow.cpp +++ b/lsmainwindow.cpp @@ -22,6 +22,7 @@ #include <QInputDialog> #include <QMessageBox> #include "lyt/archivepackage.h" +#include "lyt/directorypackage.h" #include "lslayoutwindow.h" LSMainWindow::LSMainWindow(QWidget *parent) : QMainWindow(parent) { @@ -51,6 +52,7 @@ void LSMainWindow::createActions() { m_openArchiveAction = new QAction("&Open Archive...", this); m_saveAction = new QAction("&Save", this); m_saveArchiveAsAction = new QAction("Save Archive &As...", this); + m_openDirAction = new QAction("Open Directory...", this); m_newArchiveAction->setShortcuts(QKeySequence::New); m_openArchiveAction->setShortcuts(QKeySequence::Open); @@ -61,6 +63,7 @@ void LSMainWindow::createActions() { connect(m_openArchiveAction, SIGNAL(triggered()), SLOT(openArchive())); connect(m_saveAction, SIGNAL(triggered()), SLOT(save())); connect(m_saveArchiveAsAction, SIGNAL(triggered()), SLOT(saveArchiveAs())); + connect(m_openDirAction, SIGNAL(triggered()), SLOT(openDir())); m_addLayoutAction = new QAction("New &Layout...", this); m_addAnimationAction = new QAction("New &Animation...", this); @@ -92,6 +95,7 @@ void LSMainWindow::createActions() { m->addAction(m_openArchiveAction); m->addAction(m_saveAction); m->addAction(m_saveArchiveAsAction); + m->addAction(m_openDirAction); m = bar->addMenu("&Edit"); m->addAction(m_addLayoutAction); @@ -292,6 +296,21 @@ void LSMainWindow::saveArchiveAs() { updateTitleBar(); } +void LSMainWindow::openDir() { + QString path = QFileDialog::getExistingDirectory(this, + "Choose Archive Directory"); + + if (path.isEmpty()) + return; + + LYTDirectoryPackage *pkg = new LYTDirectoryPackage(path); + setCurrentPackage(pkg); + + m_dirty = false; + m_isSaved = true; + updateTitleBar(); +} + void LSMainWindow::setCurrentPackage(LYTPackageBase *pkg) { m_package = pkg; |