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