1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-02 05:06:40 +00:00

Fixing profile code in progress...

This commit is contained in:
graffy76 2013-08-18 17:11:23 -05:00
parent f6217f9c6a
commit e614ec3353
6 changed files with 175 additions and 114 deletions

View file

@ -22,10 +22,7 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
ContentSelector(parent)
{
// Hide the profile elements
profileLabel->hide();
profilesComboBox->hide();
newProfileButton->hide();
deleteProfileButton->hide();
profileGroupBox->hide();
// Add some extra widgets
QHBoxLayout *nameLayout = new QHBoxLayout();
@ -34,12 +31,12 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
mNameLabel = new QLabel(tr("File Name:"), this);
QRegExpValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9\\s]*$"));
//mNameLineEdit = new LineEdit(this);
//mNameLineEdit->setValidator(validator);
mNameLineEdit = new EsxView::LineEdit(this);
mNameLineEdit->setValidator(validator);
nameLayout->addSpacerItem(spacer);
nameLayout->addWidget(mNameLabel);
//nameLayout->addWidget(mNameLineEdit);
nameLayout->addWidget(mNameLineEdit);
mButtonBox = new QDialogButtonBox(this);

View file

@ -14,10 +14,16 @@ class QPushButton;
class QStringList;
class QString;
class QMenu;
class QLabel;
class DataFilesModel;
class PluginsProxyModel;
namespace EsxView
{
class LineEdit;
}
namespace CSVDoc
{
class FileDialog : public EsxView::ContentSelector
@ -48,7 +54,7 @@ namespace CSVDoc
private:
QLabel *mNameLabel;
//LineEdit *mNameLineEdit;
EsxView::LineEdit *mNameLineEdit;
QPushButton *mCreateButton;
QDialogButtonBox *mButtonBox;

View file

@ -25,9 +25,11 @@ void EsxView::ContentSelector::buildModelsAndViews()
mMasterProxyModel = new EsxModel::MasterProxyModel (this, mDataFilesModel);
mPluginsProxyModel = new EsxModel::PluginsProxyModel (this, mDataFilesModel);
masterView->setPlaceholderText(QString("Select a game file..."));
masterView->setModel(mMasterProxyModel);
pluginView->setModel(mPluginsProxyModel);
pluginView->
profilesComboBox->setPlaceholderText(QString("Select a profile..."));
connect(mDataFilesModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
connect(pluginView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotPluginTableItemClicked(const QModelIndex &)));

View file

@ -103,6 +103,11 @@ void EsxView::ProfilesComboBox::paintEvent(QPaintEvent *)
// draw the icon and text
if (!opt.editable && currentIndex() == -1) // <<< we adjust the text displayed when nothing is selected
opt.currentText = tr("Select a game file...");
opt.currentText = mPlaceholderText;
painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
}
void EsxView::ProfilesComboBox::setPlaceholderText(const QString &text)
{
mPlaceholderText = text;
}

View file

@ -14,6 +14,7 @@ namespace EsxView
public:
explicit ProfilesComboBox(QWidget *parent = 0);
void setEditEnabled(bool editable);
void setPlaceholderText (const QString &text);
signals:
void profileChanged(const QString &previous, const QString &current);
@ -26,6 +27,7 @@ namespace EsxView
private:
QString mOldProfile;
QString mPlaceholderText;
QRegExpValidator *mValidator;
protected:

View file

@ -14,6 +14,27 @@
<enum>Qt::DefaultContextMenu</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="contentGroupBox">
<property name="title">
<string>Content</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="filterLayout">
<item>
@ -69,15 +90,42 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="profileLabel">
<property name="text">
<string>Current Profile:</string>
</property>
</layout>
<zorder>pluginView</zorder>
<zorder>masterView</zorder>
<zorder>pluginView</zorder>
<zorder>masterView</zorder>
<zorder></zorder>
<zorder></zorder>
</widget>
</item>
<item>
<widget class="QGroupBox" name="profileGroupBox">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="title">
<string>Profiles</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="EsxView::ProfilesComboBox" name="profilesComboBox">
<property name="enabled">
@ -121,6 +169,7 @@
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<action name="newProfileAction">