forked from teamnwah/openmw-tes3coop
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)
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 &)));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 ¤t);
|
||||
|
@ -26,6 +27,7 @@ namespace EsxView
|
|||
|
||||
private:
|
||||
QString mOldProfile;
|
||||
QString mPlaceholderText;
|
||||
QRegExpValidator *mValidator;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -14,113 +14,162 @@
|
|||
<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>
|
||||
<layout class="QHBoxLayout" name="filterLayout">
|
||||
<item>
|
||||
<widget class="EsxView::ProfilesComboBox" name="masterView">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="profileLabel">
|
||||
<property name="text">
|
||||
<string>Current Profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="EsxView::ProfilesComboBox" name="profilesComboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="newProfileButton">
|
||||
<property name="toolTip">
|
||||
<string>New Profile</string>
|
||||
</property>
|
||||
<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>
|
||||
<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">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="newProfileButton">
|
||||
<property name="toolTip">
|
||||
<string>New Profile</string>
|
||||
</property>
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="newProfileAction">
|
||||
|
|
Loading…
Reference in a new issue