mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 02:06:41 +00:00
Fixing profile code in progress...
This commit is contained in:
parent
f6217f9c6a
commit
e614ec3353
6 changed files with 175 additions and 114 deletions
|
@ -22,10 +22,7 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
ContentSelector(parent)
|
ContentSelector(parent)
|
||||||
{
|
{
|
||||||
// Hide the profile elements
|
// Hide the profile elements
|
||||||
profileLabel->hide();
|
profileGroupBox->hide();
|
||||||
profilesComboBox->hide();
|
|
||||||
newProfileButton->hide();
|
|
||||||
deleteProfileButton->hide();
|
|
||||||
|
|
||||||
// Add some extra widgets
|
// Add some extra widgets
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout();
|
QHBoxLayout *nameLayout = new QHBoxLayout();
|
||||||
|
@ -34,12 +31,12 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
mNameLabel = new QLabel(tr("File Name:"), this);
|
mNameLabel = new QLabel(tr("File Name:"), this);
|
||||||
|
|
||||||
QRegExpValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9\\s]*$"));
|
QRegExpValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9\\s]*$"));
|
||||||
//mNameLineEdit = new LineEdit(this);
|
mNameLineEdit = new EsxView::LineEdit(this);
|
||||||
//mNameLineEdit->setValidator(validator);
|
mNameLineEdit->setValidator(validator);
|
||||||
|
|
||||||
nameLayout->addSpacerItem(spacer);
|
nameLayout->addSpacerItem(spacer);
|
||||||
nameLayout->addWidget(mNameLabel);
|
nameLayout->addWidget(mNameLabel);
|
||||||
//nameLayout->addWidget(mNameLineEdit);
|
nameLayout->addWidget(mNameLineEdit);
|
||||||
|
|
||||||
mButtonBox = new QDialogButtonBox(this);
|
mButtonBox = new QDialogButtonBox(this);
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,16 @@ class QPushButton;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
class QString;
|
class QString;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class DataFilesModel;
|
class DataFilesModel;
|
||||||
class PluginsProxyModel;
|
class PluginsProxyModel;
|
||||||
|
|
||||||
|
namespace EsxView
|
||||||
|
{
|
||||||
|
class LineEdit;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVDoc
|
namespace CSVDoc
|
||||||
{
|
{
|
||||||
class FileDialog : public EsxView::ContentSelector
|
class FileDialog : public EsxView::ContentSelector
|
||||||
|
@ -48,7 +54,7 @@ namespace CSVDoc
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *mNameLabel;
|
QLabel *mNameLabel;
|
||||||
//LineEdit *mNameLineEdit;
|
EsxView::LineEdit *mNameLineEdit;
|
||||||
|
|
||||||
QPushButton *mCreateButton;
|
QPushButton *mCreateButton;
|
||||||
QDialogButtonBox *mButtonBox;
|
QDialogButtonBox *mButtonBox;
|
||||||
|
|
|
@ -25,9 +25,11 @@ void EsxView::ContentSelector::buildModelsAndViews()
|
||||||
mMasterProxyModel = new EsxModel::MasterProxyModel (this, mDataFilesModel);
|
mMasterProxyModel = new EsxModel::MasterProxyModel (this, mDataFilesModel);
|
||||||
mPluginsProxyModel = new EsxModel::PluginsProxyModel (this, mDataFilesModel);
|
mPluginsProxyModel = new EsxModel::PluginsProxyModel (this, mDataFilesModel);
|
||||||
|
|
||||||
|
masterView->setPlaceholderText(QString("Select a game file..."));
|
||||||
masterView->setModel(mMasterProxyModel);
|
masterView->setModel(mMasterProxyModel);
|
||||||
pluginView->setModel(mPluginsProxyModel);
|
pluginView->setModel(mPluginsProxyModel);
|
||||||
pluginView->
|
profilesComboBox->setPlaceholderText(QString("Select a profile..."));
|
||||||
|
|
||||||
|
|
||||||
connect(mDataFilesModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
|
connect(mDataFilesModel, SIGNAL(layoutChanged()), this, SLOT(updateViews()));
|
||||||
connect(pluginView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotPluginTableItemClicked(const QModelIndex &)));
|
connect(pluginView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotPluginTableItemClicked(const QModelIndex &)));
|
||||||
|
|
|
@ -103,6 +103,11 @@ void EsxView::ProfilesComboBox::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
// draw the icon and text
|
// draw the icon and text
|
||||||
if (!opt.editable && currentIndex() == -1) // <<< we adjust the text displayed when nothing is selected
|
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);
|
painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EsxView::ProfilesComboBox::setPlaceholderText(const QString &text)
|
||||||
|
{
|
||||||
|
mPlaceholderText = text;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace EsxView
|
||||||
public:
|
public:
|
||||||
explicit ProfilesComboBox(QWidget *parent = 0);
|
explicit ProfilesComboBox(QWidget *parent = 0);
|
||||||
void setEditEnabled(bool editable);
|
void setEditEnabled(bool editable);
|
||||||
|
void setPlaceholderText (const QString &text);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void profileChanged(const QString &previous, const QString ¤t);
|
void profileChanged(const QString &previous, const QString ¤t);
|
||||||
|
@ -26,6 +27,7 @@ namespace EsxView
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mOldProfile;
|
QString mOldProfile;
|
||||||
|
QString mPlaceholderText;
|
||||||
QRegExpValidator *mValidator;
|
QRegExpValidator *mValidator;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -14,113 +14,162 @@
|
||||||
<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>
|
||||||
<layout class="QHBoxLayout" name="filterLayout">
|
<widget class="QGroupBox" name="contentGroupBox">
|
||||||
<item>
|
<property name="title">
|
||||||
<widget class="EsxView::ProfilesComboBox" name="masterView">
|
<string>Content</string>
|
||||||
<property name="editable">
|
</property>
|
||||||
<bool>false</bool>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
</widget>
|
<number>9</number>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="filterLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="EsxView::ProfilesComboBox" name="masterView">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="pluginView">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textElideMode">
|
||||||
|
<enum>Qt::ElideLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<zorder>pluginView</zorder>
|
||||||
|
<zorder>masterView</zorder>
|
||||||
|
<zorder>pluginView</zorder>
|
||||||
|
<zorder>masterView</zorder>
|
||||||
|
<zorder></zorder>
|
||||||
|
<zorder></zorder>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<widget class="QGroupBox" name="profileGroupBox">
|
||||||
<item>
|
<property name="focusPolicy">
|
||||||
<widget class="QTableView" name="pluginView">
|
<enum>Qt::NoFocus</enum>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<property name="title">
|
||||||
<horstretch>0</horstretch>
|
<string>Profiles</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<property name="flat">
|
||||||
</property>
|
<bool>false</bool>
|
||||||
<property name="contextMenuPolicy">
|
</property>
|
||||||
<enum>Qt::DefaultContextMenu</enum>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</property>
|
<property name="spacing">
|
||||||
<property name="editTriggers">
|
<number>6</number>
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
</property>
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<property name="alternatingRowColors">
|
<number>9</number>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="topMargin">
|
||||||
<property name="selectionMode">
|
<number>9</number>
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
<property name="selectionBehavior">
|
<number>0</number>
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
</property>
|
||||||
</property>
|
<property name="bottomMargin">
|
||||||
<property name="textElideMode">
|
<number>6</number>
|
||||||
<enum>Qt::ElideLeft</enum>
|
</property>
|
||||||
</property>
|
<item>
|
||||||
<property name="showGrid">
|
<widget class="EsxView::ProfilesComboBox" name="profilesComboBox">
|
||||||
<bool>false</bool>
|
<property name="enabled">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<attribute name="horizontalHeaderVisible">
|
</property>
|
||||||
<bool>false</bool>
|
<property name="sizePolicy">
|
||||||
</attribute>
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
<horstretch>0</horstretch>
|
||||||
<bool>true</bool>
|
<verstretch>0</verstretch>
|
||||||
</attribute>
|
</sizepolicy>
|
||||||
<attribute name="verticalHeaderVisible">
|
</property>
|
||||||
<bool>false</bool>
|
</widget>
|
||||||
</attribute>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QToolButton" name="newProfileButton">
|
||||||
</layout>
|
<property name="toolTip">
|
||||||
</item>
|
<string>New Profile</string>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<property name="text">
|
||||||
<item>
|
<string>&New Profile</string>
|
||||||
<widget class="QLabel" name="profileLabel">
|
</property>
|
||||||
<property name="text">
|
<property name="autoRaise">
|
||||||
<string>Current Profile:</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="EsxView::ProfilesComboBox" name="profilesComboBox">
|
<widget class="QToolButton" name="deleteProfileButton">
|
||||||
<property name="enabled">
|
<property name="toolTip">
|
||||||
<bool>true</bool>
|
<string>Delete Profile</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="text">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<string>Delete Profile</string>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="shortcut">
|
||||||
</sizepolicy>
|
<string>Ctrl+D</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="autoRaise">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QToolButton" name="newProfileButton">
|
</widget>
|
||||||
<property name="toolTip">
|
</item>
|
||||||
<string>New Profile</string>
|
</layout>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
|
||||||
<string>&New Profile</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="deleteProfileButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Delete Profile</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete Profile</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+D</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<action name="newProfileAction">
|
<action name="newProfileAction">
|
||||||
|
|
Loading…
Reference in a new issue