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) 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);

View File

@ -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;

View File

@ -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 &)));

View File

@ -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;
}

View File

@ -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 &current); void profileChanged(const QString &previous, const QString &current);
@ -26,6 +27,7 @@ namespace EsxView
private: private:
QString mOldProfile; QString mOldProfile;
QString mPlaceholderText;
QRegExpValidator *mValidator; QRegExpValidator *mValidator;
protected: protected:

View File

@ -14,6 +14,27 @@
<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>
<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> <item>
<layout class="QHBoxLayout" name="filterLayout"> <layout class="QHBoxLayout" name="filterLayout">
<item> <item>
@ -69,15 +90,42 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> </layout>
<layout class="QHBoxLayout" name="horizontalLayout"> <zorder>pluginView</zorder>
<item> <zorder>masterView</zorder>
<widget class="QLabel" name="profileLabel"> <zorder>pluginView</zorder>
<property name="text"> <zorder>masterView</zorder>
<string>Current Profile:</string> <zorder></zorder>
</property> <zorder></zorder>
</widget> </widget>
</item> </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> <item>
<widget class="EsxView::ProfilesComboBox" name="profilesComboBox"> <widget class="EsxView::ProfilesComboBox" name="profilesComboBox">
<property name="enabled"> <property name="enabled">
@ -121,6 +169,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
<action name="newProfileAction"> <action name="newProfileAction">