From 5d015723486caf4b140fcd6b701a7a1140bb52a2 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 3 Apr 2008 16:18:37 -0400 Subject: ENH: add ability to create symlinks for command line on mac from gui --- Source/QtDialog/CMakeSetupDialog.cxx | 17 +++++++++++++++-- Source/QtDialog/CMakeSetupDialog.h | 2 ++ Source/QtDialog/QMacInstallDialog.cxx | 6 ++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 10da23f..8b3eee6 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include "QCMake.h" #include "QCMakeCacheView.h" @@ -96,17 +97,23 @@ CMakeSetupDialog::CMakeSetupDialog() this->GenerateAction = ToolsMenu->addAction(tr("&Generate")); QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)), this, SLOT(doGenerate())); - +#if defined(__APPLE__) + this->InstallForCommandLineAction + = ToolsMenu->addAction(tr("&Install For Command Line Use")); + QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)), + this, SLOT(doInstallForCommandLine())); +#endif QMenu* OptionsMenu = this->menuBar()->addMenu(tr("&Options")); QAction* supressDevWarningsAction = OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)")); QObject::connect(supressDevWarningsAction, SIGNAL(triggered(bool)), this, SLOT(doSuppressDev())); + supressDevWarningsAction->setCheckable(true); QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output")); debugAction->setCheckable(true); QObject::connect(debugAction, SIGNAL(toggled(bool)), this, SLOT(setDebugOutput(bool))); - + QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help")); QAction* a = HelpMenu->addAction(tr("About")); QObject::connect(a, SIGNAL(triggered(bool)), @@ -325,6 +332,12 @@ void CMakeSetupDialog::doSuppressDev() SetSuppressDevWarnings(this->SuppressDevWarnings); } +void CMakeSetupDialog::doInstallForCommandLine() +{ + QMacInstallDialog setupdialog(0); + setupdialog.exec(); +} + void CMakeSetupDialog::doGenerate() { if(this->CurrentState == Generating) diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 1ce020d..81ef751 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -45,6 +45,7 @@ protected slots: void doConfigure(); void doGenerate(); void doSuppressDev(); + void doInstallForCommandLine(); void doHelp(); void doAbout(); void doInterrupt(); @@ -94,6 +95,7 @@ protected: QAction* ConfigureAction; QAction* GenerateAction; QAction* SuppressDevWarningsAction; + QAction* InstallForCommandLineAction; State CurrentState; }; diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index c3daaf2..57ed845 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -46,6 +46,12 @@ void QMacInstallDialog::DoInstall() newName += filename; std::cout << "ln -s [" << file << "] ["; std::cout << newName << "]\n"; + // Remove the old files + if(cmSystemTools::FileExists(newName.c_str())) + { + std::cout << "rm [" << newName << "]\n"; + cmSystemTools::RemoveFile(newName.c_str()); + } cmSystemTools::CreateSymlink(file.c_str(), newName.c_str()); } -- cgit v0.12