mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 17:36:40 +00:00
Reenabling features
Profile functions enabled New/load file functions partially enabled Layout reorganized
This commit is contained in:
parent
24e38846da
commit
6898321676
6 changed files with 60 additions and 78 deletions
|
@ -31,6 +31,8 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
||||||
{
|
{
|
||||||
QMetaObject::connectSlotsByName(this);
|
QMetaObject::connectSlotsByName(this);
|
||||||
|
|
||||||
|
projectGroupBox->hide();
|
||||||
|
|
||||||
// Create a dialog for the new profile name input
|
// Create a dialog for the new profile name input
|
||||||
mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this);
|
mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this);
|
||||||
|
|
||||||
|
@ -42,7 +44,6 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
||||||
|
|
||||||
void DataFilesPage::createActions()
|
void DataFilesPage::createActions()
|
||||||
{
|
{
|
||||||
qDebug () << "adding actions...";
|
|
||||||
// Add the actions to the toolbuttons
|
// Add the actions to the toolbuttons
|
||||||
newProfileButton->setDefaultAction(newProfileAction);
|
newProfileButton->setDefaultAction(newProfileAction);
|
||||||
deleteProfileButton->setDefaultAction(deleteProfileAction);
|
deleteProfileButton->setDefaultAction(deleteProfileAction);
|
||||||
|
@ -191,7 +192,6 @@ int DataFilesPage::profilesComboBoxIndex()
|
||||||
|
|
||||||
void DataFilesPage::on_newProfileAction_triggered()
|
void DataFilesPage::on_newProfileAction_triggered()
|
||||||
{
|
{
|
||||||
qDebug() << "new_profile_action_triggered";
|
|
||||||
if (mNewProfileDialog->exec() == QDialog::Accepted) {
|
if (mNewProfileDialog->exec() == QDialog::Accepted) {
|
||||||
QString profile = mNewProfileDialog->lineEdit()->text();
|
QString profile = mNewProfileDialog->lineEdit()->text();
|
||||||
profilesComboBox->addItem(profile);
|
profilesComboBox->addItem(profile);
|
||||||
|
|
|
@ -25,42 +25,20 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
profileGroupBox->hide();
|
profileGroupBox->hide();
|
||||||
pluginView->showColumn(2);
|
pluginView->showColumn(2);
|
||||||
|
|
||||||
// Add some extra widgets
|
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout();
|
|
||||||
QSpacerItem *spacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
||||||
|
|
||||||
mNameLabel = new QLabel(tr("File Name:"), this);
|
|
||||||
|
|
||||||
QRegExpValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9\\s]*$"));
|
|
||||||
mNameLineEdit = new EsxView::LineEdit(this);
|
|
||||||
mNameLineEdit->setValidator(validator);
|
|
||||||
|
|
||||||
nameLayout->addSpacerItem(spacer);
|
|
||||||
nameLayout->addWidget(mNameLabel);
|
|
||||||
nameLayout->addWidget(mNameLineEdit);
|
|
||||||
|
|
||||||
mButtonBox = new QDialogButtonBox(this);
|
|
||||||
|
|
||||||
mCreateButton = new QPushButton(tr("Create"), this);
|
|
||||||
mCreateButton->setEnabled(false);
|
|
||||||
|
|
||||||
verticalLayout->addLayout(nameLayout);
|
|
||||||
verticalLayout->addWidget(mButtonBox);
|
|
||||||
|
|
||||||
resize(400, 400);
|
resize(400, 400);
|
||||||
|
|
||||||
// connect(mDataFilesModel, SIGNAL(checkedItemsChanged(QStringList)), this, SLOT(updateOpenButton(QStringList)));
|
// connect(mDataFilesModel, SIGNAL(checkedItemsChanged(QStringList)), this, SLOT(updateOpenButton(QStringList)));
|
||||||
//connect(mNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
|
//connect(mNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateCreateButton(QString)));
|
||||||
|
|
||||||
// connect(mCreateButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()));
|
connect(projectCreateButton, SIGNAL(clicked()), this, SIGNAL(createNewFile()));
|
||||||
|
|
||||||
// connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(mButtonBox, SIGNAL(accepted()), this, SIGNAL(openFiles());
|
||||||
// connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
// connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::updateOpenButton(const QStringList &items)
|
void CSVDoc::FileDialog::updateOpenButton(const QStringList &items)
|
||||||
{
|
{
|
||||||
QPushButton *openButton = mButtonBox->button(QDialogButtonBox::Open);
|
QPushButton *openButton = projectButtonBox->button(QDialogButtonBox::Open);
|
||||||
|
|
||||||
if (!openButton)
|
if (!openButton)
|
||||||
return;
|
return;
|
||||||
|
@ -70,29 +48,25 @@ void CSVDoc::FileDialog::updateOpenButton(const QStringList &items)
|
||||||
|
|
||||||
void CSVDoc::FileDialog::updateCreateButton(const QString &name)
|
void CSVDoc::FileDialog::updateCreateButton(const QString &name)
|
||||||
{
|
{
|
||||||
if (!mCreateButton->isVisible())
|
if (!projectCreateButton->isVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCreateButton->setEnabled(!name.isEmpty());
|
projectCreateButton->setEnabled(!name.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSVDoc::FileDialog::fileName()
|
QString CSVDoc::FileDialog::fileName()
|
||||||
{
|
{
|
||||||
return mNameLineEdit->text();
|
return projectNameLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::openFile()
|
void CSVDoc::FileDialog::openFile()
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Open"));
|
setWindowTitle(tr("Open"));
|
||||||
|
|
||||||
mNameLabel->hide();
|
projectNameLineEdit->hide();
|
||||||
mNameLineEdit->hide();
|
projectCreateButton->hide();
|
||||||
mCreateButton->hide();
|
projectGroupBox->setTitle(tr(""));
|
||||||
|
projectButtonBox->button(QDialogButtonBox::Open)->setEnabled(false);
|
||||||
mButtonBox->removeButton(mCreateButton);
|
|
||||||
mButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Open);
|
|
||||||
QPushButton *openButton = mButtonBox->button(QDialogButtonBox::Open);
|
|
||||||
openButton->setEnabled(false);
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
|
@ -103,25 +77,10 @@ void CSVDoc::FileDialog::newFile()
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("New"));
|
setWindowTitle(tr("New"));
|
||||||
|
|
||||||
mNameLabel->show();
|
projectButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
||||||
mNameLineEdit->clear();
|
projectButtonBox->addButton(projectCreateButton, QDialogButtonBox::ActionRole);
|
||||||
mNameLineEdit->show();
|
|
||||||
mCreateButton->show();
|
|
||||||
|
|
||||||
mButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
|
||||||
mButtonBox->addButton(mCreateButton, QDialogButtonBox::ActionRole);
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::accept()
|
|
||||||
{
|
|
||||||
emit openFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSVDoc::FileDialog::createButtonClicked()
|
|
||||||
{
|
|
||||||
emit createNewFile();
|
|
||||||
}
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace CSVDoc
|
||||||
|
|
||||||
void openFile();
|
void openFile();
|
||||||
void newFile();
|
void newFile();
|
||||||
void accepted();
|
|
||||||
|
|
||||||
QString fileName();
|
QString fileName();
|
||||||
|
|
||||||
|
@ -43,21 +42,11 @@ namespace CSVDoc
|
||||||
void createNewFile();
|
void createNewFile();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//void updateViews();
|
//void updateViews();
|
||||||
void updateOpenButton(const QStringList &items);
|
void updateOpenButton(const QStringList &items);
|
||||||
void updateCreateButton(const QString &name);
|
void updateCreateButton(const QString &name);
|
||||||
|
|
||||||
void createButtonClicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QLabel *mNameLabel;
|
|
||||||
EsxView::LineEdit *mNameLineEdit;
|
|
||||||
|
|
||||||
QPushButton *mCreateButton;
|
|
||||||
QDialogButtonBox *mButtonBox;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // FILEDIALOG_HPP
|
#endif // FILEDIALOG_HPP
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#include <QStylePainter>
|
||||||
|
|
||||||
#include "lineedit.hpp"
|
#include "lineedit.hpp"
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace EsxView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
QString mPlaceholderText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineEdit(QWidget *parent = 0);
|
LineEdit(QWidget *parent = 0);
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,6 @@
|
||||||
<enum>Qt::DefaultContextMenu</enum>
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="contentGroupBox">
|
<widget class="QGroupBox" name="contentGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -91,21 +85,53 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>pluginView</zorder>
|
|
||||||
<zorder>masterView</zorder>
|
|
||||||
<zorder>pluginView</zorder>
|
|
||||||
<zorder>masterView</zorder>
|
|
||||||
<zorder></zorder>
|
<zorder></zorder>
|
||||||
<zorder></zorder>
|
<zorder></zorder>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="projectGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Project</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="EsxView::LineEdit" name="projectNameLineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Enter project name...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="projectButtonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Open</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="projectCreateButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<zorder>projectButtonBox</zorder>
|
||||||
|
<zorder>projectCreateButton</zorder>
|
||||||
|
<zorder>projectNameLineEdit</zorder>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="profileGroupBox">
|
<widget class="QGroupBox" name="profileGroupBox">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Profiles</string>
|
<string>Profile</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -221,6 +247,11 @@
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header location="global">components/esxselector/view/profilescombobox.hpp</header>
|
<header location="global">components/esxselector/view/profilescombobox.hpp</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>EsxView::LineEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header location="global">components/esxselector/view/lineedit.hpp</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Reference in a new issue