2013-03-07 02:00:59 +00:00
|
|
|
#include "filedialog.hpp"
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QRegExpValidator>
|
|
|
|
#include <QRegExp>
|
|
|
|
#include <QSpacerItem>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QLabel>
|
2013-09-23 04:52:53 +00:00
|
|
|
#include <QGroupBox>
|
2013-09-29 17:19:07 +00:00
|
|
|
#include <QGridLayout>
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-09-22 04:06:29 +00:00
|
|
|
#include <components/contentselector/model/esmfile.hpp>
|
|
|
|
#include <components/contentselector/view/lineedit.hpp>
|
2013-09-29 17:19:07 +00:00
|
|
|
#include "components/contentselector/view/contentselector.hpp"
|
2013-09-23 04:52:53 +00:00
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
2013-09-29 17:19:07 +00:00
|
|
|
QDialog(parent),
|
|
|
|
mOpenFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_LoadAddon),
|
|
|
|
mNewFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_NewAddon)
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
{
|
2013-08-18 14:34:33 +00:00
|
|
|
resize(400, 400);
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
void CSVDoc::FileDialog::addFiles(const QString &path)
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-09-29 17:19:07 +00:00
|
|
|
ContentSelectorView::ContentSelector::addFiles(path);
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
QString CSVDoc::FileDialog::filename()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-10-07 02:13:47 +00:00
|
|
|
return ContentSelectorView::ContentSelector::instance().projectFilename();
|
2013-09-29 17:19:07 +00:00
|
|
|
}
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-10-02 02:29:45 +00:00
|
|
|
QStringList CSVDoc::FileDialog::selectedFilePaths()
|
2013-09-29 17:19:07 +00:00
|
|
|
{
|
2013-10-02 02:29:45 +00:00
|
|
|
QStringList filePaths;
|
|
|
|
|
|
|
|
foreach (ContentSelectorModel::EsmFile *file, ContentSelectorView::ContentSelector::
|
|
|
|
instance().selectedFiles() )
|
|
|
|
{
|
|
|
|
filePaths.append(file->fileName());
|
|
|
|
}
|
|
|
|
return filePaths;
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
void CSVDoc::FileDialog::showDialog()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-09-29 17:19:07 +00:00
|
|
|
show();
|
|
|
|
raise();
|
|
|
|
activateWindow();
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
void CSVDoc::FileDialog::openFile()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
|
|
|
setWindowTitle(tr("Open"));
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
ContentSelectorView::ContentSelector::configure(this, mOpenFileFlags);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
|
|
SIGNAL (accepted()), this, SIGNAL (openFiles()));
|
|
|
|
|
|
|
|
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
|
|
SIGNAL (rejected()), this, SLOT (slotRejected()));
|
|
|
|
|
|
|
|
showDialog();
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
void CSVDoc::FileDialog::newFile()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
|
|
|
setWindowTitle(tr("New"));
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
ContentSelectorView::ContentSelector::configure(this, mNewFileFlags);
|
2013-09-23 04:52:53 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
|
|
SIGNAL (accepted()), this, SIGNAL (createNewFile()));
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
|
|
SIGNAL (rejected()), this, SLOT (slotRejected()));
|
2013-09-23 04:52:53 +00:00
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
showDialog();
|
2013-09-23 04:52:53 +00:00
|
|
|
}
|
|
|
|
|
2013-09-29 17:19:07 +00:00
|
|
|
void CSVDoc::FileDialog::slotRejected()
|
2013-09-23 04:52:53 +00:00
|
|
|
{
|
2013-09-29 17:19:07 +00:00
|
|
|
close();
|
2013-09-23 04:52:53 +00:00
|
|
|
}
|