BUG: Fix behavior of CMakeSetupDialog::set{Binary|Source}Directory
so they work right when called externally. Disable the generate button when one hits configure again. ENH: Some UI tweaks for spacing. Allow viewing cache values while configure/generate (but not edit).
This commit is contained in:
parent
696a016444
commit
31d4280bf3
|
@ -162,10 +162,9 @@ void CMakeSetupDialog::initialize()
|
||||||
this, SLOT(doBinaryBrowse()));
|
this, SLOT(doBinaryBrowse()));
|
||||||
|
|
||||||
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
|
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
|
||||||
this, SLOT(setBinaryDirectory(QString)));
|
this, SLOT(onBinaryDirectoryChanged(QString)));
|
||||||
QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
|
QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
|
||||||
this->CMakeThread->cmakeInstance(),
|
this, SLOT(onSourceDirectoryChanged(QString)));
|
||||||
SLOT(setSourceDirectory(QString)));
|
|
||||||
|
|
||||||
QObject::connect(this->CMakeThread->cmakeInstance(),
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
||||||
SIGNAL(sourceDirChanged(QString)),
|
SIGNAL(sourceDirChanged(QString)),
|
||||||
|
@ -207,7 +206,20 @@ void CMakeSetupDialog::initialize()
|
||||||
|
|
||||||
// get the saved binary directories
|
// get the saved binary directories
|
||||||
QStringList buildPaths = this->loadBuildPaths();
|
QStringList buildPaths = this->loadBuildPaths();
|
||||||
|
this->BinaryDirectory->blockSignals(true);
|
||||||
this->BinaryDirectory->addItems(buildPaths);
|
this->BinaryDirectory->addItems(buildPaths);
|
||||||
|
this->BinaryDirectory->blockSignals(false);
|
||||||
|
|
||||||
|
if(!this->SourceDirectory->text().isEmpty() ||
|
||||||
|
!this->BinaryDirectory->lineEdit()->text().isEmpty())
|
||||||
|
{
|
||||||
|
this->onSourceDirectoryChanged(this->SourceDirectory->text());
|
||||||
|
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeSetupDialog::~CMakeSetupDialog()
|
CMakeSetupDialog::~CMakeSetupDialog()
|
||||||
|
@ -251,9 +263,11 @@ void CMakeSetupDialog::doConfigure()
|
||||||
|
|
||||||
// remember path
|
// remember path
|
||||||
this->addBinaryPath(dir.absolutePath());
|
this->addBinaryPath(dir.absolutePath());
|
||||||
|
|
||||||
this->InterruptButton->setEnabled(true);
|
this->InterruptButton->setEnabled(true);
|
||||||
this->setEnabledState(false);
|
this->setEnabledState(false);
|
||||||
|
this->setGenerateEnabled(false);
|
||||||
|
|
||||||
this->Output->clear();
|
this->Output->clear();
|
||||||
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
||||||
"setProperties", Qt::QueuedConnection,
|
"setProperties", Qt::QueuedConnection,
|
||||||
|
@ -405,10 +419,20 @@ void CMakeSetupDialog::doBinaryBrowse()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
|
void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
|
||||||
|
{
|
||||||
|
this->BinaryDirectory->setEditText(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
||||||
|
"setSourceDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
|
||||||
{
|
{
|
||||||
this->CacheValues->cacheModel()->clear();
|
this->CacheValues->cacheModel()->clear();
|
||||||
this->Output->clear();
|
this->Output->clear();
|
||||||
this->BinaryDirectory->setEditText(dir);
|
|
||||||
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
||||||
"setBinaryDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
|
"setBinaryDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
|
||||||
}
|
}
|
||||||
|
@ -441,7 +465,7 @@ void CMakeSetupDialog::error(const QString& title, const QString& message,
|
||||||
void CMakeSetupDialog::setEnabledState(bool enabled)
|
void CMakeSetupDialog::setEnabledState(bool enabled)
|
||||||
{
|
{
|
||||||
// disable parts of the GUI during configure/generate
|
// disable parts of the GUI during configure/generate
|
||||||
this->CacheValues->setEnabled(enabled);
|
this->CacheValues->cacheModel()->setEditEnabled(enabled);
|
||||||
this->SourceDirectory->setEnabled(enabled);
|
this->SourceDirectory->setEnabled(enabled);
|
||||||
this->BrowseSourceDirectoryButton->setEnabled(enabled);
|
this->BrowseSourceDirectoryButton->setEnabled(enabled);
|
||||||
this->BinaryDirectory->setEnabled(enabled);
|
this->BinaryDirectory->setEnabled(enabled);
|
||||||
|
|
|
@ -66,6 +66,8 @@ protected slots:
|
||||||
void addBinaryPath(const QString&);
|
void addBinaryPath(const QString&);
|
||||||
QStringList loadBuildPaths();
|
QStringList loadBuildPaths();
|
||||||
void saveBuildPaths(const QStringList&);
|
void saveBuildPaths(const QStringList&);
|
||||||
|
void onBinaryDirectoryChanged(const QString& dir);
|
||||||
|
void onSourceDirectoryChanged(const QString& dir);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent*);
|
void closeEvent(QCloseEvent*);
|
||||||
|
|
|
@ -67,6 +67,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType" >
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
|
|
|
@ -124,7 +124,8 @@ void QCMakeCacheView::setSearchFilter(const QString& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
QCMakeCacheModel::QCMakeCacheModel(QObject* p)
|
QCMakeCacheModel::QCMakeCacheModel(QObject* p)
|
||||||
: QAbstractTableModel(p), NewCount(0), ModifiedValues(false)
|
: QAbstractTableModel(p),
|
||||||
|
NewCount(0), ModifiedValues(false), EditEnabled(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +174,16 @@ QCMakeCachePropertyList QCMakeCacheModel::properties() const
|
||||||
return this->Properties;
|
return this->Properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QCMakeCacheModel::setEditEnabled(bool e)
|
||||||
|
{
|
||||||
|
this->EditEnabled = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QCMakeCacheModel::editEnabled() const
|
||||||
|
{
|
||||||
|
return this->EditEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
int QCMakeCacheModel::columnCount (const QModelIndex& /*p*/ ) const
|
int QCMakeCacheModel::columnCount (const QModelIndex& /*p*/ ) const
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -250,7 +261,7 @@ Qt::ItemFlags QCMakeCacheModel::flags (const QModelIndex& idx) const
|
||||||
{
|
{
|
||||||
Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
// all column 1's are editable
|
// all column 1's are editable
|
||||||
if(idx.column() == 1)
|
if(idx.column() == 1 && this->EditEnabled)
|
||||||
{
|
{
|
||||||
f |= Qt::ItemIsEditable;
|
f |= Qt::ItemIsEditable;
|
||||||
// booleans are editable in place
|
// booleans are editable in place
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setProperties(const QCMakeCachePropertyList& props);
|
void setProperties(const QCMakeCachePropertyList& props);
|
||||||
void clear();
|
void clear();
|
||||||
|
void setEditEnabled(bool);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// satisfy [pure] virtuals
|
// satisfy [pure] virtuals
|
||||||
|
@ -80,11 +81,15 @@ public:
|
||||||
bool modifiedValues() const;
|
bool modifiedValues() const;
|
||||||
// get the properties
|
// get the properties
|
||||||
QCMakeCachePropertyList properties() const;
|
QCMakeCachePropertyList properties() const;
|
||||||
|
|
||||||
|
// editing enabled
|
||||||
|
bool editEnabled() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QCMakeCachePropertyList Properties;
|
QCMakeCachePropertyList Properties;
|
||||||
int NewCount;
|
int NewCount;
|
||||||
bool ModifiedValues;
|
bool ModifiedValues;
|
||||||
|
bool EditEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Qt delegate class for interaction (or other customization)
|
/// Qt delegate class for interaction (or other customization)
|
||||||
|
|
Loading…
Reference in New Issue