|
|
|
@ -17,14 +17,17 @@
|
|
|
|
|
#include "filewidget.hpp"
|
|
|
|
|
#include "adjusterwidget.hpp"
|
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent), mSelector (0)
|
|
|
|
|
QDialog(parent), mSelector (0), mFileWidget (0), mAdjusterWidget (0)
|
|
|
|
|
{
|
|
|
|
|
ui.setupUi (this);
|
|
|
|
|
resize(400, 400);
|
|
|
|
|
|
|
|
|
|
setObjectName ("FileDialog");
|
|
|
|
|
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
|
|
|
|
mAdjusterWidget = new AdjusterWidget (this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::addFiles(const QString &path)
|
|
|
|
@ -42,6 +45,14 @@ QStringList CSVDoc::FileDialog::selectedFilePaths()
|
|
|
|
|
return filePaths;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::setLocalData (const boost::filesystem::path& localData)
|
|
|
|
|
{
|
|
|
|
|
if (mDialogType != DialogType_New)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mAdjusterWidget->setLocalData (localData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::showDialog(DialogType dialogType)
|
|
|
|
|
{
|
|
|
|
|
mDialogType = dialogType;
|
|
|
|
@ -63,7 +74,6 @@ void CSVDoc::FileDialog::showDialog(DialogType dialogType)
|
|
|
|
|
connect (mSelector, SIGNAL (signalCurrentGamefileIndexChanged (int)),
|
|
|
|
|
this, SLOT (slotUpdateAcceptButton (int)));
|
|
|
|
|
|
|
|
|
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (createNewFile()));
|
|
|
|
|
connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected()));
|
|
|
|
|
|
|
|
|
|
show();
|
|
|
|
@ -85,17 +95,26 @@ void CSVDoc::FileDialog::buildNewFileView()
|
|
|
|
|
mFileWidget->extensionLabelIsVisible(true);
|
|
|
|
|
|
|
|
|
|
ui.projectGroupBoxLayout->insertWidget (0, mFileWidget);
|
|
|
|
|
ui.projectGroupBoxLayout->insertWidget (1, mAdjusterWidget);
|
|
|
|
|
|
|
|
|
|
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
|
|
|
|
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
|
|
|
|
|
|
|
|
|
connect (mFileWidget, SIGNAL (nameChanged(const QString &, bool)),
|
|
|
|
|
this, SLOT (slotUpdateAcceptButton(const QString &, bool)));
|
|
|
|
|
|
|
|
|
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::buildOpenFileView()
|
|
|
|
|
{
|
|
|
|
|
setWindowTitle(tr("Open"));
|
|
|
|
|
ui.projectGroupBox->setTitle (QString(""));
|
|
|
|
|
ui.projectGroupBox->layout()->addWidget (mAdjusterWidget);
|
|
|
|
|
|
|
|
|
|
ui.projectButtonBox->button(QDialogButtonBox::Ok)->setEnabled (false);
|
|
|
|
|
|
|
|
|
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::slotUpdateAcceptButton (int)
|
|
|
|
@ -121,7 +140,7 @@ void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString &name, bool)
|
|
|
|
|
QString CSVDoc::FileDialog::filename() const
|
|
|
|
|
{
|
|
|
|
|
if (mDialogType == DialogType_New)
|
|
|
|
|
return mFileWidget->getName();
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
return mSelector->currentFile();
|
|
|
|
|
}
|
|
|
|
@ -131,3 +150,17 @@ void CSVDoc::FileDialog::slotRejected()
|
|
|
|
|
emit rejected();
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::slotNewFile()
|
|
|
|
|
{
|
|
|
|
|
emit signalCreateNewFile (mAdjusterWidget->getPath());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::FileDialog::slotOpenFile()
|
|
|
|
|
{
|
|
|
|
|
ContentSelectorModel::EsmFile *file = mSelector->selectedFiles().back();
|
|
|
|
|
|
|
|
|
|
mAdjusterWidget->setName (file->fileName(), !file->isGameFile());
|
|
|
|
|
|
|
|
|
|
emit signalOpenFiles (mAdjusterWidget->getPath());
|
|
|
|
|
}
|
|
|
|
|