1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 16:53:55 +00:00
openmw/apps/opencs/view/doc/filedialog.cpp

81 lines
1.9 KiB
C++
Raw Normal View History

#include "filedialog.hpp"
#include <QCheckBox>
#include <QPushButton>
#include <QDialogButtonBox>
#include <QSortFilterProxyModel>
#include <QRegExpValidator>
#include <QRegExp>
#include <QSpacerItem>
#include <QPushButton>
#include <QLabel>
#include <components/contentselector/model/esmfile.hpp>
#include <components/contentselector/view/lineedit.hpp>
2013-08-17 02:12:30 +00:00
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
ContentSelector(parent)
{
// Hide the profile elements
2013-08-18 22:11:23 +00:00
profileGroupBox->hide();
addonView->showColumn(2);
resize(400, 400);
2013-08-20 17:34:39 +00:00
connect(projectNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
connect(projectCreateButton, SIGNAL(clicked()), this, SIGNAL(createNewFile()));
2013-08-20 17:34:39 +00:00
connect(projectButtonBox, SIGNAL(accepted()), this, SIGNAL(openFiles()));
connect(projectButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
void CSVDoc::FileDialog::updateOpenButton(const QStringList &items)
{
QPushButton *openButton = projectButtonBox->button(QDialogButtonBox::Open);
if (!openButton)
return;
openButton->setEnabled(!items.isEmpty());
}
void CSVDoc::FileDialog::updateCreateButton(const QString &name)
{
if (!projectCreateButton->isVisible())
return;
projectCreateButton->setEnabled(!name.isEmpty());
}
QString CSVDoc::FileDialog::fileName()
{
return projectNameLineEdit->text();
}
void CSVDoc::FileDialog::openFile()
{
setWindowTitle(tr("Open"));
projectNameLineEdit->hide();
projectCreateButton->hide();
projectGroupBox->setTitle(tr(""));
projectButtonBox->button(QDialogButtonBox::Open)->setEnabled(false);
show();
raise();
activateWindow();
}
void CSVDoc::FileDialog::newFile()
{
setWindowTitle(tr("New"));
projectButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
projectButtonBox->addButton(projectCreateButton, QDialogButtonBox::ActionRole);
show();
raise();
activateWindow();
}