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.
This commit is contained in:
parent
1c0595c73f
commit
df3169273a
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "CMakeSetupDialog.h"
|
#include "CMakeSetupDialog.h"
|
||||||
#include "cmDocumentation.h"
|
#include "cmDocumentation.h"
|
||||||
#include "cmSystemTools.h"
|
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmVersion.h"
|
#include "cmVersion.h"
|
||||||
#include <cmsys/CommandLineArguments.hxx>
|
#include <cmsys/CommandLineArguments.hxx>
|
||||||
@ -73,7 +72,6 @@ int main(int argc, char** argv)
|
|||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
cmExecDir.cd("../../../");
|
cmExecDir.cd("../../../");
|
||||||
#endif
|
#endif
|
||||||
cmSystemTools::FindExecutableDirectory(cmExecDir.filePath("cmake").toAscii().data());
|
|
||||||
|
|
||||||
// pick up translation files if they exists in the data directory
|
// pick up translation files if they exists in the data directory
|
||||||
QDir translationsDir = cmExecDir;
|
QDir translationsDir = cmExecDir;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
#include "QCMake.h"
|
#include "QCMake.h"
|
||||||
#include "QCMakeCacheView.h"
|
#include "QCMakeCacheView.h"
|
||||||
@ -97,6 +98,7 @@ CMakeSetupDialog::CMakeSetupDialog()
|
|||||||
QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
|
QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(doGenerate()));
|
this, SLOT(doGenerate()));
|
||||||
|
|
||||||
|
|
||||||
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
|
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
|
||||||
QAction* a = HelpMenu->addAction(tr("About"));
|
QAction* a = HelpMenu->addAction(tr("About"));
|
||||||
QObject::connect(a, SIGNAL(triggered(bool)),
|
QObject::connect(a, SIGNAL(triggered(bool)),
|
||||||
@ -105,6 +107,10 @@ CMakeSetupDialog::CMakeSetupDialog()
|
|||||||
QObject::connect(a, SIGNAL(triggered(bool)),
|
QObject::connect(a, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(doHelp()));
|
this, SLOT(doHelp()));
|
||||||
|
|
||||||
|
QShortcut* filterShortcut = new QShortcut(QKeySequence::Find, this);
|
||||||
|
QObject::connect(filterShortcut, SIGNAL(activated()),
|
||||||
|
this, SLOT(startSearch()));
|
||||||
|
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
// get the saved binary directories
|
// get the saved binary directories
|
||||||
@ -266,6 +272,7 @@ void CMakeSetupDialog::doConfigure()
|
|||||||
this->enterState(Configuring);
|
this->enterState(Configuring);
|
||||||
|
|
||||||
this->Output->clear();
|
this->Output->clear();
|
||||||
|
this->CacheValues->selectionModel()->clear();
|
||||||
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
||||||
"setProperties", Qt::QueuedConnection,
|
"setProperties", Qt::QueuedConnection,
|
||||||
Q_ARG(QCMakeCachePropertyList,
|
Q_ARG(QCMakeCachePropertyList,
|
||||||
@ -829,3 +836,10 @@ void CMakeSetupDialog::addCacheEntry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeSetupDialog::startSearch()
|
||||||
|
{
|
||||||
|
this->Search->setFocus(Qt::OtherFocusReason);
|
||||||
|
this->Search->selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ protected slots:
|
|||||||
void removeSelectedCacheEntries();
|
void removeSelectedCacheEntries();
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
void addCacheEntry();
|
void addCacheEntry();
|
||||||
|
void startSearch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -31,22 +31,27 @@ QCMake::QCMake(QObject* p)
|
|||||||
qRegisterMetaType<QCMakeCacheProperty>();
|
qRegisterMetaType<QCMakeCacheProperty>();
|
||||||
qRegisterMetaType<QCMakeCachePropertyList>();
|
qRegisterMetaType<QCMakeCachePropertyList>();
|
||||||
|
|
||||||
QDir appDir(QCoreApplication::applicationDirPath());
|
QDir execDir(QCoreApplication::applicationDirPath());
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
this->CMakeExecutable = appDir.filePath("cmake.exe");
|
QString cmakeGUICommand = QString("cmake-gui")+cmSystemTools::GetExecutableExtension();
|
||||||
#elif defined(Q_OS_MAC)
|
cmakeGUICommand = execDir.filePath(cmakeGUICommand);
|
||||||
appDir.cd("../../../"); // path to cmake in build directory (need to fix for deployment)
|
|
||||||
this->CMakeExecutable = appDir.filePath("cmake");
|
#if defined(Q_OS_MAC)
|
||||||
#else
|
execDir.cd("../../../"); // path to cmake in build directory (need to fix for deployment)
|
||||||
this->CMakeExecutable = appDir.filePath("cmake");
|
|
||||||
#endif
|
#endif
|
||||||
// TODO: check for existence?
|
|
||||||
|
QString cmakeCommand = QString("cmake")+cmSystemTools::GetExecutableExtension();
|
||||||
|
cmakeCommand = execDir.filePath(cmakeCommand);
|
||||||
|
|
||||||
|
|
||||||
cmSystemTools::DisableRunCommandOutput();
|
cmSystemTools::DisableRunCommandOutput();
|
||||||
cmSystemTools::SetRunCommandHideConsole(true);
|
cmSystemTools::SetRunCommandHideConsole(true);
|
||||||
cmSystemTools::SetErrorCallback(QCMake::errorCallback, this);
|
cmSystemTools::SetErrorCallback(QCMake::errorCallback, this);
|
||||||
|
cmSystemTools::FindExecutableDirectory(cmakeCommand.toAscii().data());
|
||||||
|
|
||||||
this->CMakeInstance = new cmake;
|
this->CMakeInstance = new cmake;
|
||||||
|
this->CMakeInstance->SetCMakeCommand(cmakeCommand.toAscii().data());
|
||||||
|
//this->CMakeInstance->SetCMakeEditCommand(cmakeGUICommand.toAscii().data());
|
||||||
this->CMakeInstance->SetCMakeEditCommand("cmake-gui");
|
this->CMakeInstance->SetCMakeEditCommand("cmake-gui");
|
||||||
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
|
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
|
||||||
|
|
||||||
@ -131,7 +136,6 @@ void QCMake::configure()
|
|||||||
this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toAscii().data());
|
this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toAscii().data());
|
||||||
this->CMakeInstance->SetGlobalGenerator(
|
this->CMakeInstance->SetGlobalGenerator(
|
||||||
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
|
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
|
||||||
this->CMakeInstance->SetCMakeCommand(this->CMakeExecutable.toAscii().data());
|
|
||||||
this->CMakeInstance->LoadCache();
|
this->CMakeInstance->LoadCache();
|
||||||
this->CMakeInstance->PreLoadCMakeFiles();
|
this->CMakeInstance->PreLoadCMakeFiles();
|
||||||
|
|
||||||
|
@ -75,6 +75,9 @@ QCMakeCacheView::QCMakeCacheView(QWidget* p)
|
|||||||
QAbstractItemView::EditKeyPressed |
|
QAbstractItemView::EditKeyPressed |
|
||||||
QAbstractItemView::AnyKeyPressed);
|
QAbstractItemView::AnyKeyPressed);
|
||||||
|
|
||||||
|
// tab, backtab doesn't step through items
|
||||||
|
this->setTabKeyNavigation(false);
|
||||||
|
|
||||||
// set up headers and sizes
|
// set up headers and sizes
|
||||||
int h = 0;
|
int h = 0;
|
||||||
QFontMetrics met(this->font());
|
QFontMetrics met(this->font());
|
||||||
@ -105,33 +108,14 @@ QCMakeCacheModel* QCMakeCacheView::cacheModel() const
|
|||||||
QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
|
QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
|
||||||
Qt::KeyboardModifiers mod)
|
Qt::KeyboardModifiers mod)
|
||||||
{
|
{
|
||||||
// tab through values only (not names)
|
// want home/end to go to begin/end of rows, not columns
|
||||||
QModelIndex current = this->currentIndex();
|
if(act == MoveHome)
|
||||||
if(act == MoveNext)
|
|
||||||
{
|
{
|
||||||
if(!current.isValid())
|
return this->model()->index(0, 1);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(act == MovePrevious)
|
else if(act == MoveEnd)
|
||||||
{
|
{
|
||||||
if(!current.isValid())
|
return this->model()->index(this->model()->rowCount()-1, 1);
|
||||||
{
|
|
||||||
return this->model()->index(0, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return this->model()->index(current.row()-1, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return QTableView::moveCursor(act, mod);
|
return QTableView::moveCursor(act, mod);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user