mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-12 21:39:26 +00:00
00c78a4aa1
Moved AdjusterWidget / FileWidget to ContentSelectorView
93 lines
2.3 KiB
C++
93 lines
2.3 KiB
C++
#include "filedialog.hpp"
|
|
|
|
#include <QCheckBox>
|
|
#include <QPushButton>
|
|
#include <QDialogButtonBox>
|
|
#include <QSortFilterProxyModel>
|
|
#include <QRegExpValidator>
|
|
#include <QRegExp>
|
|
#include <QSpacerItem>
|
|
#include <QPushButton>
|
|
#include <QLabel>
|
|
#include <QGroupBox>
|
|
#include <QGridLayout>
|
|
|
|
#include <components/contentselector/model/esmfile.hpp>
|
|
#include <components/contentselector/view/lineedit.hpp>
|
|
#include "components/contentselector/view/contentselector.hpp"
|
|
|
|
#include <QDebug>
|
|
|
|
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();
|
|
}
|