[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.3 1.4
CMakeSetupDialog.h 1.4 1.5 CMakeSetupDialog.ui 1.2 1.3
QCMake.cxx 1.3 1.4 QCMake.h 1.4 1.5 QCMakeCacheView.cxx 1.4 1.5
QCMakeCacheView.h 1.5 1.6
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Nov 3 19:49:01 EDT 2007
Update of /cvsroot/CMake/CMake/Source/QtDialog
In directory public:/mounts/ram/cvs-serv8211
Modified Files:
CMakeSetupDialog.cxx CMakeSetupDialog.h CMakeSetupDialog.ui
QCMake.cxx QCMake.h QCMakeCacheView.cxx QCMakeCacheView.h
Log Message:
ENH: Allow working with empty build directories.
Make output window a bit smaller compared to cache view.
Prompt on X'ing window as well as hitting cancel.
Color new cache values red, and put them first.
Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- QCMakeCacheView.cxx 3 Nov 2007 17:28:09 -0000 1.4
+++ QCMakeCacheView.cxx 3 Nov 2007 23:48:59 -0000 1.5
@@ -88,7 +88,7 @@
}
QCMakeCacheModel::QCMakeCacheModel(QObject* p)
- : QAbstractTableModel(p), IsDirty(false)
+ : QAbstractTableModel(p), NewCount(0), IsDirty(false)
{
}
@@ -101,9 +101,28 @@
return this->IsDirty;
}
+static uint qHash(const QCMakeCacheProperty& p)
+{
+ return qHash(p.Key);
+}
+
void QCMakeCacheModel::setProperties(const QCMakeCachePropertyList& props)
{
- this->Properties = props;
+ QSet<QCMakeCacheProperty> newProps = props.toSet();
+ QSet<QCMakeCacheProperty> oldProps = this->Properties.toSet();
+
+ oldProps.intersect(newProps);
+ newProps.subtract(oldProps);
+
+ this->NewCount = newProps.count();
+ this->Properties.clear();
+
+ this->Properties = newProps.toList();
+ qSort(this->Properties);
+ QCMakeCachePropertyList tmp = oldProps.toList();
+ qSort(tmp);
+ this->Properties += tmp;
+
this->reset();
this->IsDirty = false;
}
@@ -155,6 +174,10 @@
{
return this->Properties[index.row()].Advanced;
}
+ else if(role == Qt::BackgroundRole && index.row()+1 <= this->NewCount)
+ {
+ return QBrush(QColor(255,100,100));
+ }
return QVariant();
}
Index: CMakeSetupDialog.ui
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.ui,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CMakeSetupDialog.ui 3 Nov 2007 14:30:52 -0000 1.2
+++ CMakeSetupDialog.ui 3 Nov 2007 23:48:59 -0000 1.3
@@ -74,7 +74,7 @@
</layout>
</item>
<item>
- <widget class="QSplitter" name="splitter" >
+ <widget class="QSplitter" name="Splitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- QCMakeCacheView.h 3 Nov 2007 16:50:02 -0000 1.5
+++ QCMakeCacheView.h 3 Nov 2007 23:48:59 -0000 1.6
@@ -73,6 +73,7 @@
protected:
QCMakeCachePropertyList Properties;
+ int NewCount;
bool IsDirty;
};
Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CMakeSetupDialog.cxx 3 Nov 2007 14:30:52 -0000 1.3
+++ CMakeSetupDialog.cxx 3 Nov 2007 23:48:59 -0000 1.4
@@ -24,6 +24,7 @@
#include <QStatusBar>
#include <QToolButton>
#include <QDialogButtonBox>
+#include <QCloseEvent>
#include "QCMake.h"
#include "QCMakeCacheView.h"
@@ -50,6 +51,8 @@
this->resize(700, 500);
QWidget* cont = new QWidget(this);
this->setupUi(cont);
+ this->Splitter->setStretchFactor(0, 2);
+ this->Splitter->setStretchFactor(1, 1);
this->setCentralWidget(cont);
this->ProgressBar = new QProgressBar();
this->ProgressBar->setRange(0,100);
@@ -87,7 +90,7 @@
this, SLOT(doOk()));
QObject::connect(this->CancelButton, SIGNAL(clicked(bool)),
- this, SLOT(doCancel()));
+ this, SLOT(close()));
QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
this, SLOT(doSourceBrowse()));
@@ -96,6 +99,8 @@
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
this->CMakeThread->CMakeInstance, SLOT(setBinaryDirectory(QString)));
+ QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
+ this->CMakeThread->CMakeInstance, SLOT(setSourceDirectory(QString)));
QObject::connect(this->CMakeThread->CMakeInstance, SIGNAL(sourceDirChanged(QString)),
this, SLOT(updateSourceDirectory(QString)));
@@ -127,6 +132,21 @@
void CMakeSetupDialog::doConfigure()
{
+ QDir dir(this->BinaryDirectory->currentText());
+ if(!dir.exists())
+ {
+ QString message = tr("Build directory does not exist, should I create it?\n\n"
+ "Directory: ");
+ message += this->BinaryDirectory->currentText();
+ QString title = tr("Create Directory");
+ QMessageBox::StandardButton btn =
+ QMessageBox::information(this, title, message, QMessageBox::Yes | QMessageBox::No);
+ if(btn == QMessageBox::No)
+ {
+ return;
+ }
+ dir.mkpath(".");
+ }
this->InterruptButton->setEnabled(true);
this->setEnabledState(false);
this->Output->clear();
@@ -178,8 +198,8 @@
QMetaObject::invokeMethod(this->CMakeThread->CMakeInstance,
"generate", Qt::QueuedConnection);
}
-
-void CMakeSetupDialog::doCancel()
+
+void CMakeSetupDialog::closeEvent(QCloseEvent* e)
{
if(this->CacheValues->cacheModel()->isDirty())
{
@@ -187,14 +207,12 @@
"are you sure you want to exit?");
QString title = tr("Confirm Exit");
QMessageBox::StandardButton btn =
- QMessageBox::critical(this, title, message, QMessageBox::Ok | QMessageBox::Cancel);
- if(btn == QMessageBox::Cancel)
+ QMessageBox::critical(this, title, message, QMessageBox::Yes | QMessageBox::No);
+ if(btn == QMessageBox::No)
{
- return;
+ e->ignore();
}
}
-
- QApplication::quit();
}
void CMakeSetupDialog::doHelp()
@@ -242,13 +260,16 @@
tr("Enter Path to Source"), this->SourceDirectory->text());
if(!dir.isEmpty())
{
- this->updateSourceDirectory(dir);
+ this->SourceDirectory->setText(dir);
}
}
void CMakeSetupDialog::updateSourceDirectory(const QString& dir)
{
- this->SourceDirectory->setText(dir);
+ if(this->SourceDirectory->text() != dir)
+ {
+ this->SourceDirectory->setText(dir);
+ }
}
void CMakeSetupDialog::doBinaryBrowse()
@@ -265,6 +286,7 @@
{
if(dir != this->BinaryDirectory->currentText())
{
+ this->CacheValues->cacheModel()->setProperties(QCMakeCachePropertyList());
this->Output->clear();
this->BinaryDirectory->setEditText(dir);
}
Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CMakeSetupDialog.h 3 Nov 2007 16:50:02 -0000 1.4
+++ CMakeSetupDialog.h 3 Nov 2007 23:48:59 -0000 1.5
@@ -36,7 +36,6 @@
void initialize();
void doConfigure();
void doOk();
- void doCancel();
void doHelp();
void doInterrupt();
void finishConfigure(int error);
@@ -51,6 +50,7 @@
void setEnabledState(bool);
protected:
+ void closeEvent(QCloseEvent*);
QCMakeThread* CMakeThread;
QProgressBar* ProgressBar;
Index: QCMake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- QCMake.h 3 Nov 2007 16:50:02 -0000 1.4
+++ QCMake.h 3 Nov 2007 23:48:59 -0000 1.5
@@ -40,6 +40,8 @@
QString Help;
PropertyType Type;
bool Advanced;
+ bool operator==(const QCMakeCacheProperty& other) const { return this->Key == other.Key; }
+ bool operator<(const QCMakeCacheProperty& other) const { return this->Key < other.Key; }
};
// make types usable with QVariant
Index: QCMake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- QCMake.cxx 3 Nov 2007 14:30:52 -0000 1.3
+++ QCMake.cxx 3 Nov 2007 23:48:59 -0000 1.4
@@ -61,21 +61,27 @@
void QCMake::setSourceDirectory(const QString& dir)
{
- this->SourceDirectory = dir;
- emit this->sourceDirChanged(dir);
+ if(this->SourceDirectory != dir)
+ {
+ this->SourceDirectory = dir;
+ emit this->sourceDirChanged(dir);
+ }
}
void QCMake::setBinaryDirectory(const QString& dir)
{
- cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
- this->BinaryDirectory = dir;
- this->CMakeInstance->GetCacheManager()->LoadCache(dir.toLocal8Bit().data());
- QCMakeCachePropertyList props = this->properties();
- emit this->propertiesChanged(props);
- cmCacheManager::CacheIterator itm = cachem->NewIterator();
- if ( itm.Find("CMAKE_HOME_DIRECTORY"))
+ if(this->BinaryDirectory != dir)
{
- setSourceDirectory(itm.GetValue());
+ cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
+ this->BinaryDirectory = dir;
+ this->CMakeInstance->GetCacheManager()->LoadCache(dir.toLocal8Bit().data());
+ QCMakeCachePropertyList props = this->properties();
+ emit this->propertiesChanged(props);
+ cmCacheManager::CacheIterator itm = cachem->NewIterator();
+ if ( itm.Find("CMAKE_HOME_DIRECTORY"))
+ {
+ setSourceDirectory(itm.GetValue());
+ }
}
}
More information about the Cmake-commits
mailing list