[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.35 1.36
QCMakeCacheView.cxx 1.25 1.26 QCMakeCacheView.h 1.16 1.17
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Feb 14 19:58:33 EST 2008
Update of /cvsroot/CMake/CMake/Source/QtDialog
In directory public:/mounts/ram/cvs-serv20802
Modified Files:
CMakeSetupDialog.cxx QCMakeCacheView.cxx QCMakeCacheView.h
Log Message:
ENH: Convert native paths from QFileDialog and QDirModel/QCompleter.
BUG: Block possible completion loop.
Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- CMakeSetupDialog.cxx 14 Feb 2008 23:18:10 -0000 1.35
+++ CMakeSetupDialog.cxx 15 Feb 2008 00:58:31 -0000 1.36
@@ -24,8 +24,6 @@
#include <QDialogButtonBox>
#include <QCloseEvent>
#include <QCoreApplication>
-#include <QCompleter>
-#include <QDirModel>
#include <QSettings>
#include <QMenu>
#include <QMenuBar>
@@ -117,16 +115,8 @@
QStringList buildPaths = this->loadBuildPaths();
this->BinaryDirectory->addItems(buildPaths);
- QCompleter* compBinaryDir = new QCompleter(this);
- QDirModel* modelBinaryDir = new QDirModel(compBinaryDir);
- modelBinaryDir->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
- compBinaryDir->setModel(modelBinaryDir);
- this->BinaryDirectory->setCompleter(compBinaryDir);
- QCompleter* compSourceDir = new QCompleter(this);
- QDirModel* modelSourceDir = new QDirModel(compSourceDir);
- modelSourceDir->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
- compSourceDir->setModel(modelSourceDir);
- this->SourceDirectory->setCompleter(compSourceDir);
+ this->BinaryDirectory->setCompleter(new QCMakeFileCompleter(this, true));
+ this->SourceDirectory->setCompleter(new QCMakeFileCompleter(this, true));
// start the cmake worker thread
@@ -416,7 +406,7 @@
tr("Enter Path to Source"), this->SourceDirectory->text());
if(!dir.isEmpty())
{
- this->setSourceDirectory(dir);
+ this->setSourceDirectory(QDir::fromNativeSeparators(dir));
}
}
@@ -424,7 +414,9 @@
{
if(this->SourceDirectory->text() != dir)
{
- this->setSourceDirectory(dir);
+ this->SourceDirectory->blockSignals(true);
+ this->SourceDirectory->setText(dir);
+ this->SourceDirectory->blockSignals(false);
}
}
@@ -434,7 +426,7 @@
tr("Enter Path to Build"), this->BinaryDirectory->currentText());
if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText())
{
- this->setBinaryDirectory(dir);
+ this->setBinaryDirectory(QDir::fromNativeSeparators(dir));
}
}
Index: QCMakeCacheView.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- QCMakeCacheView.h 7 Feb 2008 22:58:57 -0000 1.16
+++ QCMakeCacheView.h 15 Feb 2008 00:58:31 -0000 1.17
@@ -25,6 +25,7 @@
#include <QLineEdit>
#include <QItemDelegate>
#include <QSortFilterProxyModel>
+#include <QCompleter>
class QCMakeCacheModel;
class QToolButton;
@@ -139,5 +140,13 @@
void chooseFile();
};
+/// completer class that returns native cmake paths
+class QCMakeFileCompleter : public QCompleter
+{
+public:
+ QCMakeFileCompleter(QObject* o, bool dirs);
+ virtual QString pathFromIndex(const QModelIndex& idx) const;
+};
+
#endif
Index: QCMakeCacheView.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMakeCacheView.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- QCMakeCacheView.cxx 14 Feb 2008 23:18:10 -0000 1.25
+++ QCMakeCacheView.cxx 15 Feb 2008 00:58:31 -0000 1.26
@@ -27,7 +27,6 @@
#include <QKeyEvent>
#include <QMenu>
#include <QDirModel>
-#include <QCompleter>
static QRegExp AdvancedRegExp[2] = { QRegExp("(false)"), QRegExp("(true|false)") };
@@ -460,20 +459,13 @@
QCMakeCacheFilePathEditor::QCMakeCacheFilePathEditor(QWidget* p, const QString& var)
: QCMakeCacheFileEditor(p, var)
{
- QCompleter* comp = new QCompleter(this);
- QDirModel* model = new QDirModel(comp);
- comp->setModel(model);
- this->setCompleter(comp);
+ this->setCompleter(new QCMakeFileCompleter(this, false));
}
QCMakeCachePathEditor::QCMakeCachePathEditor(QWidget* p, const QString& var)
: QCMakeCacheFileEditor(p, var)
{
- QCompleter* comp = new QCompleter(this);
- QDirModel* model = new QDirModel(comp);
- model->setFilter(QDir::AllDirs | QDir::Drives);
- comp->setModel(model);
- this->setCompleter(comp);
+this->setCompleter(new QCMakeFileCompleter(this, true));
}
void QCMakeCacheFileEditor::resizeEvent(QResizeEvent* e)
@@ -504,7 +496,7 @@
if(!path.isEmpty())
{
- this->setText(path);
+ this->setText(QDir::fromNativeSeparators(path));
}
}
@@ -525,8 +517,23 @@
path = QFileDialog::getExistingDirectory(this, title, this->text());
if(!path.isEmpty())
{
- this->setText(path);
+ this->setText(QDir::fromNativeSeparators(path));
}
}
+QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs)
+ : QCompleter(o)
+{
+ QDirModel* model = new QDirModel(this);
+ if(dirs)
+ {
+ model->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
+ }
+ this->setModel(model);
+}
+
+QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const
+{
+ return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx));
+}
More information about the Cmake-commits
mailing list