#include "filedialog.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "components/contentselector/view/contentselector.hpp" #include CSVDoc::FileDialog::FileDialog(QWidget *parent) : QDialog(parent), mOpenFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_LoadAddon), mNewFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_NewAddon) { resize(400, 400); } void CSVDoc::FileDialog::addFiles(const QString &path) { ContentSelectorView::ContentSelector::addFiles(path); } QString CSVDoc::FileDialog::filename() { return ContentSelectorView::ContentSelector::instance().filename(); } QStringList CSVDoc::FileDialog::selectedFilePaths() { QStringList filePaths; foreach (ContentSelectorModel::EsmFile *file, ContentSelectorView::ContentSelector:: instance().selectedFiles() ) { filePaths.append(file->fileName()); } return filePaths; } void CSVDoc::FileDialog::showDialog() { show(); raise(); activateWindow(); } void CSVDoc::FileDialog::openFile() { setWindowTitle(tr("Open")); ContentSelectorView::ContentSelector::configure(this, mOpenFileFlags); connect (&ContentSelectorView::ContentSelector::instance(), SIGNAL (accepted()), this, SIGNAL (openFiles())); connect (&ContentSelectorView::ContentSelector::instance(), SIGNAL (rejected()), this, SLOT (slotRejected())); showDialog(); } void CSVDoc::FileDialog::newFile() { setWindowTitle(tr("New")); ContentSelectorView::ContentSelector::configure(this, mNewFileFlags); connect (&ContentSelectorView::ContentSelector::instance(), SIGNAL (accepted()), this, SIGNAL (createNewFile())); connect (&ContentSelectorView::ContentSelector::instance(), SIGNAL (rejected()), this, SLOT (slotRejected())); showDialog(); } void CSVDoc::FileDialog::slotRejected() { close(); }