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-08-18 20:11:29 +00:00
|
|
|
#include <components/esxselector/model/datafilesmodel.hpp>
|
|
|
|
#include <components/esxselector/model/pluginsproxymodel.hpp>
|
|
|
|
#include <components/esxselector/model/esmfile.hpp>
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
#include <components/esxselector/view/lineedit.hpp>
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
#include "components/esxselector/model/masterproxymodel.hpp"
|
2013-08-17 02:12:30 +00:00
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
2013-08-17 03:23:21 +00:00
|
|
|
ContentSelector(parent)
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
|
|
|
// Hide the profile elements
|
2013-08-18 22:11:23 +00:00
|
|
|
profileGroupBox->hide();
|
2013-08-20 08:23:32 +00:00
|
|
|
pluginView->showColumn(2);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-18 14:34:33 +00:00
|
|
|
resize(400, 400);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-09-07 20:57:40 +00:00
|
|
|
// connect(mDataFilesModel, SIGNAL(checkedItemsChanged(QStringList)), this, SLOT(updateOpenButton(QStringList)));
|
2013-08-20 17:34:39 +00:00
|
|
|
connect(projectNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-20 13:16:56 +00:00
|
|
|
connect(projectCreateButton, SIGNAL(clicked()), this, SIGNAL(createNewFile()));
|
2013-03-07 02:00:59 +00:00
|
|
|
|
2013-08-20 17:34:39 +00:00
|
|
|
connect(projectButtonBox, SIGNAL(accepted()), this, SIGNAL(openFiles()));
|
|
|
|
connect(projectButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
void CSVDoc::FileDialog::updateOpenButton(const QStringList &items)
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-08-20 13:16:56 +00:00
|
|
|
QPushButton *openButton = projectButtonBox->button(QDialogButtonBox::Open);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
|
|
|
if (!openButton)
|
|
|
|
return;
|
|
|
|
|
|
|
|
openButton->setEnabled(!items.isEmpty());
|
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
void CSVDoc::FileDialog::updateCreateButton(const QString &name)
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-08-20 13:16:56 +00:00
|
|
|
if (!projectCreateButton->isVisible())
|
2013-03-07 02:00:59 +00:00
|
|
|
return;
|
|
|
|
|
2013-08-20 13:16:56 +00:00
|
|
|
projectCreateButton->setEnabled(!name.isEmpty());
|
2013-03-07 02:00:59 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
QString CSVDoc::FileDialog::fileName()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
2013-08-20 13:16:56 +00:00
|
|
|
return projectNameLineEdit->text();
|
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-08-20 13:16:56 +00:00
|
|
|
projectNameLineEdit->hide();
|
|
|
|
projectCreateButton->hide();
|
|
|
|
projectGroupBox->setTitle(tr(""));
|
|
|
|
projectButtonBox->button(QDialogButtonBox::Open)->setEnabled(false);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
|
|
|
show();
|
|
|
|
raise();
|
|
|
|
activateWindow();
|
|
|
|
}
|
|
|
|
|
2013-08-18 20:11:29 +00:00
|
|
|
void CSVDoc::FileDialog::newFile()
|
2013-03-07 02:00:59 +00:00
|
|
|
{
|
|
|
|
setWindowTitle(tr("New"));
|
|
|
|
|
2013-08-20 13:16:56 +00:00
|
|
|
projectButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
|
|
|
projectButtonBox->addButton(projectCreateButton, QDialogButtonBox::ActionRole);
|
2013-03-07 02:00:59 +00:00
|
|
|
|
|
|
|
show();
|
|
|
|
raise();
|
|
|
|
activateWindow();
|
|
|
|
}
|