summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2008-02-14 18:18:10 -0500
committerClinton Stimpson <clinton@elemtech.com>2008-02-14 18:18:10 -0500
commitdf3169273a3333efe8ecb45da51e4c53b5d27fe9 (patch)
tree7972ad42f50bf836d9a8e71ebc7f1f70b8250ee7 /Source
parent1c0595c73fe1fa88b67691794eef8ee10edfc257 (diff)
downloadcmake-df3169273a3333efe8ecb45da51e4c53b5d27fe9.tar.gz
ENH: Add shortcut to start search/filter.
A bit of cleanup. Disable tab navigation in cache variable list. Enable home/end keys. BUG: Ensure currently edited values are saved before doing configure.
Diffstat (limited to 'Source')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx14
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h1
-rw-r--r--Source/QtDialog/QCMake.cxx24
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx32
5 files changed, 37 insertions, 36 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 8be36f9254..b43f728edd 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -23,7 +23,6 @@
#include "CMakeSetupDialog.h"
#include "cmDocumentation.h"
-#include "cmSystemTools.h"
#include "cmake.h"
#include "cmVersion.h"
#include <cmsys/CommandLineArguments.hxx>
@@ -73,7 +72,6 @@ int main(int argc, char** argv)
#if defined(Q_OS_MAC)
cmExecDir.cd("../../../");
#endif
- cmSystemTools::FindExecutableDirectory(cmExecDir.filePath("cmake").toAscii().data());
// pick up translation files if they exists in the data directory
QDir translationsDir = cmExecDir;
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 090a137b8b..5a280c9559 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -32,6 +32,7 @@
#include <QDragEnterEvent>
#include <QMimeData>
#include <QUrl>
+#include <QShortcut>
#include "QCMake.h"
#include "QCMakeCacheView.h"
@@ -96,6 +97,7 @@ CMakeSetupDialog::CMakeSetupDialog()
this->GenerateAction = ToolsMenu->addAction(tr("&Generate"));
QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
this, SLOT(doGenerate()));
+
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
QAction* a = HelpMenu->addAction(tr("About"));
@@ -105,6 +107,10 @@ CMakeSetupDialog::CMakeSetupDialog()
QObject::connect(a, SIGNAL(triggered(bool)),
this, SLOT(doHelp()));
+ QShortcut* filterShortcut = new QShortcut(QKeySequence::Find, this);
+ QObject::connect(filterShortcut, SIGNAL(activated()),
+ this, SLOT(startSearch()));
+
this->setAcceptDrops(true);
// get the saved binary directories
@@ -266,6 +272,7 @@ void CMakeSetupDialog::doConfigure()
this->enterState(Configuring);
this->Output->clear();
+ this->CacheValues->selectionModel()->clear();
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
"setProperties", Qt::QueuedConnection,
Q_ARG(QCMakeCachePropertyList,
@@ -829,3 +836,10 @@ void CMakeSetupDialog::addCacheEntry()
}
}
+void CMakeSetupDialog::startSearch()
+{
+ this->Search->setFocus(Qt::OtherFocusReason);
+ this->Search->selectAll();
+}
+
+
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 652660a53c..b2dbce67da 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -71,6 +71,7 @@ protected slots:
void removeSelectedCacheEntries();
void selectionChanged();
void addCacheEntry();
+ void startSearch();
protected:
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 01c23da912..020bdb8d5a 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -31,22 +31,27 @@ QCMake::QCMake(QObject* p)
qRegisterMetaType<QCMakeCacheProperty>();
qRegisterMetaType<QCMakeCachePropertyList>();
- QDir appDir(QCoreApplication::applicationDirPath());
-#if defined(Q_OS_WIN)
- this->CMakeExecutable = appDir.filePath("cmake.exe");
-#elif defined(Q_OS_MAC)
- appDir.cd("../../../"); // path to cmake in build directory (need to fix for deployment)
- this->CMakeExecutable = appDir.filePath("cmake");
-#else
- this->CMakeExecutable = appDir.filePath("cmake");
+ QDir execDir(QCoreApplication::applicationDirPath());
+
+ QString cmakeGUICommand = QString("cmake-gui")+cmSystemTools::GetExecutableExtension();
+ cmakeGUICommand = execDir.filePath(cmakeGUICommand);
+
+#if defined(Q_OS_MAC)
+ execDir.cd("../../../"); // path to cmake in build directory (need to fix for deployment)
#endif
- // TODO: check for existence?
+
+ QString cmakeCommand = QString("cmake")+cmSystemTools::GetExecutableExtension();
+ cmakeCommand = execDir.filePath(cmakeCommand);
+
cmSystemTools::DisableRunCommandOutput();
cmSystemTools::SetRunCommandHideConsole(true);
cmSystemTools::SetErrorCallback(QCMake::errorCallback, this);
+ cmSystemTools::FindExecutableDirectory(cmakeCommand.toAscii().data());
this->CMakeInstance = new cmake;
+ this->CMakeInstance->SetCMakeCommand(cmakeCommand.toAscii().data());
+ //this->CMakeInstance->SetCMakeEditCommand(cmakeGUICommand.toAscii().data());
this->CMakeInstance->SetCMakeEditCommand("cmake-gui");
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
@@ -131,7 +136,6 @@ void QCMake::configure()
this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toAscii().data());
this->CMakeInstance->SetGlobalGenerator(
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
- this->CMakeInstance->SetCMakeCommand(this->CMakeExecutable.toAscii().data());
this->CMakeInstance->LoadCache();
this->CMakeInstance->PreLoadCMakeFiles();
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index ba9ece322c..776e10b353 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -75,6 +75,9 @@ QCMakeCacheView::QCMakeCacheView(QWidget* p)
QAbstractItemView::EditKeyPressed |
QAbstractItemView::AnyKeyPressed);
+ // tab, backtab doesn't step through items
+ this->setTabKeyNavigation(false);
+
// set up headers and sizes
int h = 0;
QFontMetrics met(this->font());
@@ -105,33 +108,14 @@ QCMakeCacheModel* QCMakeCacheView::cacheModel() const
QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
Qt::KeyboardModifiers mod)
{
- // tab through values only (not names)
- QModelIndex current = this->currentIndex();
- if(act == MoveNext)
+ // want home/end to go to begin/end of rows, not columns
+ if(act == MoveHome)
{
- if(!current.isValid())
- {
- return this->model()->index(0, 1);
- }
- else if(current.column() == 0)
- {
- return this->model()->index(current.row(), 1);
- }
- else
- {
- return this->model()->index(current.row()+1, 1);
- }
+ return this->model()->index(0, 1);
}
- else if(act == MovePrevious)
+ else if(act == MoveEnd)
{
- if(!current.isValid())
- {
- return this->model()->index(0, 1);
- }
- else
- {
- return this->model()->index(current.row()-1, 1);
- }
+ return this->model()->index(this->model()->rowCount()-1, 1);
}
return QTableView::moveCursor(act, mod);
}